Hilitedlines and numbers
Posted: Sun Aug 30, 2015 9:23 am
Hi Everyone
I’m sure there is a simple solution to this problem, however I can’t see it right now!
I have a scrolling list field “conditions" with a list of conditions that I want to match with certain treatments listed in another field “corrections". These are to be combined and put into a field “Answers”.
The scrolling list field “corrections" is the one to select from and more than one line can be selected. This field has the list behaviour set to; multi-line, non-contiguous and click to toggle.
This script works perfectly for what I want … until I click beyond the 10th condition.
When I select line 11 of the list, the line 1 item also gets pasted into the (Answers) field. I understand that it would be related to the term ‘contains’, as 11 does ‘contain’ a 1.
Any suggestions on the correct script would be greatly appreciated. Thank you.
This is the script in field “Conditions";
on mouseup
put the hilitedlines of me into MySelection
put empty into field "Answers"
if MySelection contains "1," then
put line 7 of field "Corrections" of card id 1071 & ": (Discomfort)" && return after field "Answers"
end if
if MySelection contains "2" then
put line 6 of field "Corrections" of card id 1071 & ": (Pain)" && return after field "Answers"
end if
...
if MySelection contains "11," then
put line 8 of field "Corrections" of card id 1071 & ": (Lack of power in shoulder)" && return after field "Answers"
end if
end mouseup
I’m sure there is a simple solution to this problem, however I can’t see it right now!
I have a scrolling list field “conditions" with a list of conditions that I want to match with certain treatments listed in another field “corrections". These are to be combined and put into a field “Answers”.
The scrolling list field “corrections" is the one to select from and more than one line can be selected. This field has the list behaviour set to; multi-line, non-contiguous and click to toggle.
This script works perfectly for what I want … until I click beyond the 10th condition.
When I select line 11 of the list, the line 1 item also gets pasted into the (Answers) field. I understand that it would be related to the term ‘contains’, as 11 does ‘contain’ a 1.
Any suggestions on the correct script would be greatly appreciated. Thank you.
This is the script in field “Conditions";
on mouseup
put the hilitedlines of me into MySelection
put empty into field "Answers"
if MySelection contains "1," then
put line 7 of field "Corrections" of card id 1071 & ": (Discomfort)" && return after field "Answers"
end if
if MySelection contains "2" then
put line 6 of field "Corrections" of card id 1071 & ": (Pain)" && return after field "Answers"
end if
...
if MySelection contains "11," then
put line 8 of field "Corrections" of card id 1071 & ": (Lack of power in shoulder)" && return after field "Answers"
end if
end mouseup