Hello Users,
I need your help!
I have a column in a roster which contains names. From that, I want to create a multi select variable containing those names.
The attached file contains a sample app.
Thanks in advance
Create a multi select variable from a roster column
Create a multi select variable from a roster column
- Attachments
-
- multi-select-from-roster-column.rar
- (15.44 KiB) Downloaded 369 times
Re: Create a multi select variable from a roster column
Hello,
I solved this here: viewtopic.php?p=16688
If you're using CSDB/CSDBE, you can use SQL to built an array with data you want to display, for example Occ number and person names.
However, to extract a list of selected index, I some situations (if numeric you want to extract >10), you'll have to use this function:
I solved this here: viewtopic.php?p=16688
If you're using CSDB/CSDBE, you can use SQL to built an array with data you want to display, for example Occ number and person names.
However, to extract a list of selected index, I some situations (if numeric you want to extract >10), you'll have to use this function:
Function string extractNumeric (string alphaNumeric) {Specifically to the output of dynamic checkboxes AKA CSPro select dialog}
string result,allNumeric;
if pos('{"rowIndices":[',alphaNumeric) then
result=strip(alphanumeric[length('{"rowIndices":[')]);
allNumeric=result[2:length(result) - 3];
endif;
//errmsg ("Le(s) numero(2) de grappe(s) sont (est) %s",allNumeric);
exit allNumeric;
end;
and not the bellow that I used in the codes posted. string result,allNumeric;
if pos('{"rowIndices":[',alphaNumeric) then
result=strip(alphanumeric[length('{"rowIndices":[')]);
allNumeric=result[2:length(result) - 3];
endif;
//errmsg ("Le(s) numero(2) de grappe(s) sont (est) %s",allNumeric);
exit allNumeric;
end;
Function string extractNumericFromString (string alphaNumeric) {Can be used only to extract numeric from an alphanumeric string for items to be selected <10}
numeric i;
string isNumeric,allNumeric,result;
do i = 1 while i <= length (strip(alphanumeric))
if alphanumeric[i:1] in "0":"9" then
isNumeric=alphanumeric [i:1];
allNumeric = maketext("%s,%s", allNumeric, isNumeric);
endif;
enddo;
result = allNumeric[2:length(allNumeric)];
exit result;
end;
Best,numeric i;
string isNumeric,allNumeric,result;
do i = 1 while i <= length (strip(alphanumeric))
if alphanumeric[i:1] in "0":"9" then
isNumeric=alphanumeric [i:1];
allNumeric = maketext("%s,%s", allNumeric, isNumeric);
endif;
enddo;
result = allNumeric[2:length(allNumeric)];
exit result;
end;
G.VOLNY, a CSProuser from Haiti, since 2004
Re: Create a multi select variable from a roster column
Thanks alot for your answer, but I'm a bit confused. Where am I gonna use this function (extractNumeric) ?
I you have little time, would you please implement it into my attached app ?
Thanks in advance
I you have little time, would you please implement it into my attached app ?
Thanks in advance
Re: Create a multi select variable from a roster column
Have you downloaded and played with this download/file.php?id=2334?
G.VOLNY, a CSProuser from Haiti, since 2004
Re: Create a multi select variable from a roster column
Yes but it seems that it's not the same case with my problem. My sorry it does not help. Have you tried to open my attached app ?
Re: Create a multi select variable from a roster column
Here's a working example. And I'm almost using the same code that I previously shared with you.
However, because CSPro 8.0 select dialog have different output compare to 7.7, I had to modify the function extractNumericSelect accordingly.
Please play with the using the CSPro 8.0 beta
and let me know if you find any issues.
Best,
However, because CSPro 8.0 select dialog have different output compare to 7.7, I had to modify the function extractNumericSelect accordingly.
Please play with the using the CSPro 8.0 beta
and let me know if you find any issues.
Best,
G.VOLNY, a CSProuser from Haiti, since 2004
Re: Create a multi select variable from a roster column
Thanks alot htuser for reply. I'll try it and give you feedback