Constraining size of string lists

hi,

how to impose constraint on srting list size , string size and docuemnt list

like string list input should take only three values (names)

or size fo string should 10 or 15.

Can you provide additional context for when you would like the list constrained?

Hi,
As far as imposing specific size to a input string is concerned I guess I can help you but my assistance depends on the version you are using.

If you are using webMethods 6.5 then when you have created a flow service (flow1) and you are giving a string (str1) input to that service while doing that click on str1 in the I/O tab and navigate in the properties tab in upper right corner. You will find a parameter Content Type there. If you click that you will see the different schemas which can be used. For simple example select the int{…} schema and click customize button. You will see that you are actually defining a new schema named int_customized. There you can state the totalDigits parameter=the desired size you want, if say you give totalDigits=4 and also check the validate input checkbox in the I/O tab and save it. Now suppose you are running a service flow2 where you need to invoke flow1 in one step and you provided str1=55555 (any number>4 digits) then provided if you have Try-Catch Block the control will flow to Catch Block with an error signal and if you use pub.flow:getLastError it will retrieve an error message like input is violating constraint.

Hope this solution would help you.

Kind Regards,
Soumik G Biswas

hi,

how to impost the constraint on String list or documentlist
so that items in the list should be restricted

for example. i want to take only 0 to 4 items (input) in to the service
so how can i restict to only 4

is there any option in properties

:talker:

Hi,
Good to hear that it was of help for you :happy:. Now if you want to put any constraint for a stringList/documentList I do not think webMethods 6.5 has any such feature like that but I feel that it can be done indirectly if that supports your design.

Suppose there is an IS document Container and it has a structure like a string named size in it and a documentList/stringList named valueList in it. Now you are concerned about constraining the number of values of valueList. Now consider a flow service flow1 for which you need an input as valueList but take the input similar to as described structure of Container. In the I/O tab click on Container/size. As described earlier go to the Property pallet and click Content type. Select int{…} and click customize as described earlier. Now navigate down to the parameter pattern and add 6rows in it. If suppose you just want to allow 6inputs in your list then add 6 rows and give values 1, 2, 3, …6 in the six rows respectively. This means that it will only allow size=1|2|3|4|5|6 and no other value. Finally check the validate input checkbox and save.

Now if you are invoking flow1 inside some other IS service flow2 you can use pub.list:sizeOfList to get the size of valueList you will pass before invoking flow1 and pass the output size in the input parameter Container/size. If the numbers of values passed are greater than 6 i.e. value of Container/size>6 the control will pass to Catch Block and using pub.flow:getLastError to fetch an appropriate error message.

Hope this will help you :rolleyes:.

Kind Regards,
Soumik G Biswas