passing multiselect combo-box as parameter

Rev
New Contributor

Hi,

 

ParamA will be a multiselect combo box and the same should be passed to business rule as well.

May I know how it can be done? I'm passing the parameter in calculate button, then DM step and then to BR.

Calc button : {seq_name}{ParamCC = |!ParamA!|}

DM step: {|!ParamCC!|}

BR: Get value of ParamCC

Need suggestion on how should it be passed if parameter is multiselect.

thanks

1 ACCEPTED SOLUTION

seburn
New Contributor III

Hi. 

You can split the string in the receiving business rule by delimiter e g comma

Dim split as String() = args.NameValuePairs.XFGetValue("ParamCC").Split(",")

Then loop through rresults to get each selection e.g

For Each param As string in split

     ' Do Something 

Next

 

View solution in original post

8 REPLIES 8

seburn
New Contributor III

Hi. 

You can split the string in the receiving business rule by delimiter e g comma

Dim split as String() = args.NameValuePairs.XFGetValue("ParamCC").Split(",")

Then loop through rresults to get each selection e.g

For Each param As string in split

     ' Do Something 

Next

 

Rev
New Contributor

Thanks Seburn.I tried the suggestions provided and it works partially.Means when list of members were passed in ParamCC, it works only for the first parameter.

Dim split as String() = args.customcalculateargs.NameValuePairs.XFGetValue("ParamCC").Split(",")

For Each param As string in split

      api.logmessage(param ) ( Im able to print each param)

     ' Do Something (but it works only for first parameter passed)

Next

seburn
New Contributor III

OK. I think you need to check you are passing in the param value via button AND DM step with square brackets around the parameter (see above). This behavior sounds like you are only picking up the first comma separated value  square brackets should fix 🙂

 

E.g button

seq_name}{ParamCC=[|!ParamA!|]}

E.g DM step

ParamCC=[|!ParamA!|]

seburn
New Contributor III

E.g button

{seq_name}{ParamCC=[|!ParamA!|]}

E.g DM step

ParamCC=[|!ParamA!|]

Rev
New Contributor

It is due to space created for each member.Resolved using below line and it worked.

Dim ParamCC as string = (args.customcalculateargs.NameValuePairs.XFGetValue("ParamCC")).Replace(" ","")

Dim split as String() = ParamCC.Split(",")

For Each param As string in split

      api.logmessage(param ) ( Im able to print each param)

     ' Do Something (but it works only for first parameter passed)

Next

Thanks

Might be worth looking at String.Trim. Seems more appropriate and safer even if you don't 'expect' spaces in the middle of things.

Edit: I misread above and assumed you were taking off the spaces after you pulled it apart with the comma split which you weren't. But maybe you should be?

seburn
New Contributor III

You can use linq and stringhelper to remove whitespace from each entry in the array before you loop e.g

Dim split as String() = args.NameValuePairs.XFGetValue("ParamCC").Split(",").Select(Function(x) StringHelper.RemoveWhitespace(x)).ToArray()

seburn
New Contributor III

P.s. make sure to put square brackets around the parameter passed in via button to pick up all comma separated values e.g

{seq_name}{ParamCC=[|!ParamA!|]}