Create a multi select variable from a roster column

Discussions about CSEntry
Post Reply
blumski
Posts: 37
Joined: May 7th, 2018, 7:02 am

Create a multi select variable from a roster column

Post by blumski »

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
Attachments
multi-select-from-roster-column.rar
(15.44 KiB) Downloaded 278 times
htuser
Posts: 632
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: Create a multi select variable from a roster column

Post by htuser »

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:
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.
  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,
G.VOLNY, a CSProuser from Haiti, since 2004
blumski
Posts: 37
Joined: May 7th, 2018, 7:02 am

Re: Create a multi select variable from a roster column

Post by blumski »

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
htuser
Posts: 632
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: Create a multi select variable from a roster column

Post by htuser »

Have you downloaded and played with this download/file.php?id=2334?
G.VOLNY, a CSProuser from Haiti, since 2004
blumski
Posts: 37
Joined: May 7th, 2018, 7:02 am

Re: Create a multi select variable from a roster column

Post by blumski »

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 ?
htuser
Posts: 632
Joined: December 19th, 2011, 6:26 pm
Location: Silver Spring Area, MD, USA

Re: Create a multi select variable from a roster column

Post by htuser »

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
multi-select-from-roster-column_gv.zip
Dynamic Checkbox,
(66.6 KiB) Downloaded 298 times
using the CSPro 8.0 beta
and let me know if you find any issues.
Best,
G.VOLNY, a CSProuser from Haiti, since 2004
blumski
Posts: 37
Joined: May 7th, 2018, 7:02 am

Re: Create a multi select variable from a roster column

Post by blumski »

Thanks alot htuser for reply. I'll try it and give you feedback
Post Reply