Page 1 of 2

Runtime input list

Posted: Tue Jul 28, 2009 4:57 pm
by MikeN_(Guest)
Hi... is there any way to have the user enter a list of values at run time? I know how to have the RRS file prompt for a single value, but I need the user to be able to enter a list of customer numbers.____Thanks

=> RE: Runtime input list

Posted: Wed Jul 29, 2009 8:49 am
by kfleming
You could have them enter a list as a string of values separated by commas and then use that string in an inlist() calculation.____Kathleen__R&R Support

==> RE: Runtime input list

Posted: Wed Jul 29, 2009 5:33 pm
by MikeN_(Guest)
I tried that and I think I have a type problem. The CUSTNUM field in the table is numeric.____Here^s my calculated field:____inlist(CUSTNUM, custlist) > 0__... with custlist being the string entered in by the user____That obviously won^t work because they are two different types. So I tried:____inlist(str(CUSTNUM), custlist) > 0____That didn^t work either, even when I tried entering the customer numbers enclosed in single quotes. So then I tried:____inlist(CUSTNUM, val(custlist)) > 0____Surprisingly, that DID work, except it would only accept the first customer number in the string.____How can I make this work? Help! Help! =)____Thanks__

===> RE: Runtime input list

Posted: Thu Jul 30, 2009 9:55 am
by kfleming
Try this:__Make the CUSTNUM a string and removing any leading or trailing spaces. This should allow it to match the entry.____inlist(Trim(ltrim(str(CUSTNUM))), custlist) > 0____Kathleen__R&R Support

====> RE: Runtime input list

Posted: Fri Jul 31, 2009 3:38 pm
by MikeN_(Guest)
That^s closer, but it^s still not working... now it will accept a single customer number, but not multiple.____So if I enter ^100^, it will give the records for customer 100. If I enter ^200^, it will give the records for customer 200. However, if I enter ^100^, ^200^ (or 100, 200) I get no records.____The reason why, I believe, is because I am passing it ONE string parameter (custlist), whereas the help file specifies the syntax as INLIST(value,list-value-1,...,list-value-n). In other words, each list value is a separate string. See what I^m saying?____How can I make it work...? It seems to me that INLIST won^t work at all.____I can^t be the only one who has needed to pass a list for a parameter... any more ideas?____Thanks__Miken

====> RE: Runtime input list

Posted: Tue Aug 04, 2009 10:54 am
by MikeN_(Guest)
**BUMP____Sorry... any more ideas? Is it not do-able?____Thanks__Miken

=====> RE: Runtime input list

Posted: Tue Aug 04, 2009 11:27 am
by kfleming
Try:____Trim(ltrim(str(CUSTNUM)))$custlist____This should return true whenever a custnum is contained in the custlist.____Kathleen__R&R Support

======> RE: Runtime input list

Posted: Tue Aug 04, 2009 12:18 pm
by MikeN_(Guest)
Hmm, this sorta works. If give 1624,18595 as the custlist, grabs records for 2, 18, 1624, 18595. What happened?____Can you explain that syntax? I tried looking for it in the help file and didn^t see anything...____Thanks__Miken

=======> RE: Runtime input list

Posted: Wed Aug 05, 2009 9:17 am
by kfleming
The $ is the contained in operator. It returns true when the string on the left is contained in the string on the right.__What I failed to consider was just the situation you desribed.__2 is contained in 1624,18595 but it is not one of its members.____Let me think some more and see if I can come up with a better solution!____Regards,__Kathleen__R&R Support____

========> RE: Runtime input list

Posted: Wed Aug 05, 2009 3:36 pm
by kfleming
Try this!____Create a calculated field called LOOKFOR with the expression:__" "+trim(ltrim(str(CUSTNUM)))+" ,"____then create LOOKIN with the expression:__" "+STRREP(custlist,","," , ")+" ,"____Finally create FOUND with the expression:__LOOKFOR$LOOKIN____This should be true when the customer number has an exact match in the customer list.____Kathleen__R&R Support__