Drupal Webform : set SCORE on each SELECT Options? - drupal

I have webforms on drupal with multiple select options (radio).
And in my select, I want to say option 1 : gives 2 points, option 2 : give 1 point, etc... For after display on a webpage : your score is 12/20 points.
example :
A bear can be ... ?
0|White <- response give 2 points
1|Yellow <- response give 0 point
2|Brown <- response give 2 points
3|Dark <- response give 1 points
The question is : how to store the point of select options because there is only key|value in the admin interface?
In fact : how to add infos each select option row?

The way to do this would be to associate key with points. Thus 0 corresponds to 2 points, 1 to 0 point, 2 to 2 points and 3 to 1 point.
Thus on submission you would look at user responses and then calculate based on the responses to those particular question.
Thus under form settings would set the redirection location to a page where you process this logic and then redirect from there or show the output on the same page.

Finally, that I do :
I fill the option list with :
key_score|description
And i use explode function with _ seprator.

Related

How to either relocate a frame after it's been realized or assign a browse to another frame in Progress ABL?

Ok Progress Virtuoso's,
I'm trying to create a character UI that consists of 6 browses and 6 frames. The vision I currently have is to fire off an ON tab trigger for browse 1 that cues events - show/focus browse 2. Then on tab of browse 2 show/focus browse 3. The next tab trigger is where I am stuck because I want to do the exact same thing with some additional changes to the trigger. Those differences to the trigger involve shifting the location of browse 2/frame 2 to the position of browse 1/frame 1, shifting browse 3/frame3 to the previous position of browse 2/frame, and browse 4/ frame 4 would take 3's position.
Users View =
1 (trigger)
1 2 (trigger)
1 2 3 (trigger)
2 3 4 (trigger)
3 4 5 (trigger)
4 5 6 (trigger)
Bold indicates which frame is in focus.
I'm fairly sure that's it not possible to assign a static browse to more than one frame. Error 3475 states exactly that...however I want to be sure that is the case? Is it possible to reposition a frame after it's realized? Alternatives approaches/suggestions or any insight would be greatly appreciated.
Sorry everyone, but I was able to solve this after looking at frame attributes. Turns out you can reposition a frame with column and row attributes. If you read this...sincere apologies for wasting your time!

SAS Enterprise Guide Count IF

I'm looking to be able to perform the equivalent of a count if on a data set similar to the below. I found something similar here, but I'm not sure how to translate it into Enterprise Guide. I would like to create several new columns that count how many date occurrences there are for each primary key by year, so for example:
PrimKey Date
1 5/4/2014
2 3/1/2013
1 10/1/2014
3 9/10/2014
To be this:
PrimKey 2014 2013
1 2 0
2 0 1
3 1 0
I was hoping to use the advanced expression for calculated fields option in query builder, but if there is another better way I am completely open.
Here is what I tried (and failed):
CASE
WHEN Date(t1.DATE) BETWEEN Date(1/1/2014) and Date(12/31/2014)
THEN (COUNT(t1.DATE))
END
But that ended up just counting the total date occurrences without regard to my between statement.
Assuming you're using Query Builder you can use something like the following:
I don't think you need the CASE statement, instead use the YEAR() function to calculate the year and test if it's equal to 2014/2013. The test for equality will return a 1/0 which can be summed to the total per group. Make sure to include PrimKey in your GROUP BY section of query builder.
sum(year(t1.date)=2014) as Y2014,
sum(year(t2.date)=2013) as Y2013,
I don't like this type of solution because it's not dynamic, i.e. if your years change you have to change your code, and there's nothing in the code to return an error if that happens either. A better solution is to do a Summary Task by Year/PrimKey and then use a Transpose Task to get the data in the structure you want it.

How to read user input in the console window? [duplicate]

I am building an user input interface in R.
onload of the program, I would like like to ask the user what their preferences are according to a set of 6 fields. This will then be used as a comparison tool for the rest of the program.
e.g.,
>ThisProgram
>"Hello, on a scale of 1 to 10, how much would you say you rate the outdoors in your trips? Enter a 10 for very important, and a 1 for not important at all.
>7
>"Great. on a scale of 1 to 10, how much would you say you rate the Family Friendly in your trips? Enter a 10 for very important, and a 1 for not important at all.
>2
.
.
.
and so on...
how would I get R to ask the user a question, and then store the response in a vector?
See ?readline
> x <- readline("What is your name? ")
What is your name? Josh
> x
[1] "Josh"

Restart list numbering in word for each new list created

I am exporting content from a jsp page into MS Word using javascript.
When the user is in Word there is a table with 10 rows and 2 columns, A & B. The user creates an ordered list in row 1, column A like this:
1 dog
2 cat
3 mouse
if the user then creates a second list in row 1 column B is turns out like this:
4 car
5 truck
6 bike
instead of:
1 car
2 truck
3 bike
Word is set up to continue the numbering in lists from prior lists automatically. I know this can be reset easily but the users dont want to have to do this. They want the numbering of any potential lists created to restarted at 1. when the document is exported into Word and opened in front of them.
So this must be set up in the javasctipt code or using a style or something prior to getting into Word. This is what I dont know how to do.
Any help is much appreciated.
Thanks,
Feena.
If you use a named sequence rather than the in-built lists (as in inserting an instnace of the field {SEQ SequenceName} everywhere you want a number), and choose a different name for each of the different lists, it will work as you desire.
e.g.
{SEQ OpenIssueSeq} Issue 1
(SEQ OpenIssueSeq} Issue 2
etc.

Best way to implement a read and write for an unknown amount of rows

I asked a question similarly, but the outcome was pretty messy and I was having difficulties populating so I'm trying to go at from a different angle:
Question concerning asp:listview and multiple dynamically created controls
I have a table which stores steps in a process. Some companies only have 6 steps while others have 15, so I created a table with 15 different slots for steps. What I would like to do is set up a control that displays each step in its own row with a label next to it saying "Step '#'", and not in an adjacent column. I'd also like for it to not display any blank rows. If they are entering the step instructions, I would want for them to have to press a button that would add a row so that they aren't just given 15 empty text boxes to fill in.
What would be the best control to do this in, and how would I get started in setting it up?
You are putting data in the field names in the table, which makes your task more complicated. Instead of storing the steps in columns, like this:
CompanyId Step1 Step2 Step3 Step4 Step5 Step 6 Step7 ...
1 alpha beta gamma
2 one two three four five
You should store the steps as rows, so that you get the step number as data in a field:
CompanyId StepNumber Step
1 1 alpha
1 2 beta
1 3 gamma
2 1 one
2 2 two
2 3 three
2 4 four
2 5 five
This way you don't get any unused fields, and the data model doesn't pose any limitation on the number of steps. Also, you can easily get the steps as a collection instead of having to get each one separately and add to a collection.
Something like:
var steps =
from s in CompanySteps
where s.CompanyId = 2
orderby s.StepNumber
select new { s.StepNumber, s.Step };
Then you have many different options to display the steps, like using the collection as data source in a Repeater, or loop through the items and just create HTML code for them and put in a Literal control.

Resources