- Posts: 11
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Set one column of an Array X-Scale to number and a second column to text?
- miamiman
- Topic Author
- Offline
- New Member
Less
More
3 years 8 months ago - 3 years 8 months ago #203244
by miamiman
Set one column of an Array X-Scale to number and a second column to text? was created by miamiman
Hello people.
I'm trying to get a two (2) column array on X-Scale with one column set to "text" and another set to "number"?
I can set both to text or both to number.
Does such an option or solution exist?
I'm trying to get a two (2) column array on X-Scale with one column set to "text" and another set to "number"?
I can set both to text or both to number.
Does such an option or solution exist?
Attachments:
Last edit: 3 years 8 months ago by miamiman.
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
3 years 8 months ago #203258
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Set one column of an Array X-Scale to number and a second column to text?
Please, explain or show what you mean by
two input fields, the second only accepts numbers?
validate the second column with something like "is_numeric(Q1_Y001_X002" and ..."
one input field, the second as dropdown like an arry(numbers)?
There are many solutions here to insert a dropdown into an array(text)
one input field, the second as checkbox like an array(numbers) with checkbox display?
Waiting for your answer
Joffm
Do you wantone column set to "text" and another set to "number"?
two input fields, the second only accepts numbers?
validate the second column with something like "is_numeric(Q1_Y001_X002" and ..."
one input field, the second as dropdown like an arry(numbers)?
There are many solutions here to insert a dropdown into an array(text)
one input field, the second as checkbox like an array(numbers) with checkbox display?
Waiting for your answer
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- miamiman
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
3 years 8 months ago - 3 years 8 months ago #203262
by miamiman
Replied by miamiman on topic Set one column of an Array X-Scale to number and a second column to text?
Yes, it's an array with two column answers.
• two input fields, the first only accepts text; the second only accepts numbers.
• validate the first column with place holder and default value of "N/A" as text
• validate the second with currency numbers and thousand separators like "is_numeric(Q1_Y001_X002" and ..." as number
Is this possible? Per my image file?
https://forums.limesurvey.org/forum/attachment/21286?download=1
Thank you!
• two input fields, the first only accepts text; the second only accepts numbers.
• validate the first column with place holder and default value of "N/A" as text
• validate the second with currency numbers and thousand separators like "is_numeric(Q1_Y001_X002" and ..." as number
Is this possible? Per my image file?
https://forums.limesurvey.org/forum/attachment/21286?download=1
Thank you!
Last edit: 3 years 8 months ago by miamiman.
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
3 years 8 months ago #203279
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Set one column of an Array X-Scale to number and a second column to text?
Unfortunately there is no image attached.
But doing it the easy way.
You cannot have a placeholder AND a presetted value.
So to preset the text column to "N/A" use a question of type equation to preset this column, like
{QCode_SQ001_X001="N/A"}
{QCode_SQ002_X001="N/A"}
{QCode_SQ003_X001="N/A"}
...
To validate the second column to currency (max. two periods), use a regular expression like
regexMatch('/^[-+]?[0-9]*\.?[0-9]{0,2}$/',self.sq_SQ001_X002) and regexMatch('/^[-+]?[0-9]*\.?[0-9]{0,2}$/',self.sq_SQ002_X002) and regexMatch('/^[-+]?[0-9]*\.?[0-9]{0,2}$/',self.sq_SQ003_X002) and ...
As I said, a really easy solution.
There may be others using javascript or even an inputmask.
Read here
forums.limesurvey.org/forum/can-i-do-thi...nk-sort-codes#192539
Joffm
But doing it the easy way.
You cannot have a placeholder AND a presetted value.
So to preset the text column to "N/A" use a question of type equation to preset this column, like
{QCode_SQ001_X001="N/A"}
{QCode_SQ002_X001="N/A"}
{QCode_SQ003_X001="N/A"}
...
To validate the second column to currency (max. two periods), use a regular expression like
regexMatch('/^[-+]?[0-9]*\.?[0-9]{0,2}$/',self.sq_SQ001_X002) and regexMatch('/^[-+]?[0-9]*\.?[0-9]{0,2}$/',self.sq_SQ002_X002) and regexMatch('/^[-+]?[0-9]*\.?[0-9]{0,2}$/',self.sq_SQ003_X002) and ...
As I said, a really easy solution.
There may be others using javascript or even an inputmask.
Read here
forums.limesurvey.org/forum/can-i-do-thi...nk-sort-codes#192539
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- miamiman
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
3 years 8 months ago #203358
by miamiman
Replied by miamiman on topic Set one column of an Array X-Scale to number and a second column to text?
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
3 years 8 months ago #203376
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Set one column of an Array X-Scale to number and a second column to text?
As I said:
So you create a question of type equation before your array with the above in the question text.
You have to adapt to your question code and subquestion codes.
And this validation you enter in the "question validation equation" in "Logic"
Again you have to use your subquestion codes.
As you may see, I named the x-axis "X001", "X002"
In this sample I revised the regex a bit.
Joffm
So to preset the text column to "N/A" use a question of type equation to preset this column, like
{QCode_SQ001_X001="N/A"}
{QCode_SQ002_X001="N/A"}
{QCode_SQ003_X001="N/A"}
So you create a question of type equation before your array with the above in the question text.
You have to adapt to your question code and subquestion codes.
And this validation you enter in the "question validation equation" in "Logic"
regexMatch('/^[-+]?[0-9]*\.?[0-9]{0,2}$/',self.sq_SQ001_X002) and regexMatch('/^[-+]?[0-9]*\.?[0-9]{0,2}$/',self.sq_SQ002_X002) and regexMatch('/^[-+]?[0-9]*\.?[0-9]{0,2}$/',self.sq_SQ003_X002) and ...
Again you have to use your subquestion codes.
As you may see, I named the x-axis "X001", "X002"
In this sample I revised the regex a bit.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12888
- Thank you received: 3965
3 years 8 months ago #203405
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic Set one column of an Array X-Scale to number and a second column to text?
And after you tested everything, you have to hide the question with the equation.
Joffm
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
3 years 8 months ago #203408
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Set one column of an Array X-Scale to number and a second column to text?
To make it more user-friendly, here is a post that shows how to dynamically force numerics in an array-texts column.
- forums.limesurvey.org/forum/can-i-do-thi...question-type#174586
- forums.limesurvey.org/forum/can-i-do-thi...question-type#174586
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- miamiman
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
3 years 8 months ago #203458
by miamiman
Replied by miamiman on topic Set one column of an Array X-Scale to number and a second column to text?
Thank you. Having the sample helps immensely.
The topic has been locked.
- miamiman
- Topic Author
- Offline
- New Member
Less
More
- Posts: 11
- Thank you received: 0
3 years 8 months ago #203543
by miamiman
Replied by miamiman on topic Set one column of an Array X-Scale to number and a second column to text?
Just wanted to thank
JOFFM
again.
After many trials/errors, I finally understood the logic of setting up the question correctly.
Regards!
After many trials/errors, I finally understood the logic of setting up the question correctly.
Regards!
The topic has been locked.