How to get the particular value by Key as input from IS document.??

I am having 1 list of Document refernece variable.Say for example:–

StringFields(list of document reference)
-Key
-value

So at run time suppose 50 fileds are comming as array.(StringFields[0]StringFields[1]StringFields[2] etc…)

But I need only one Value…So my intention is: is there any way, service,or anything so that I can pass just key and get the value of respective fileld from String Field…???

So pleease suggest me the same…
Thanks for Help…

Note: I dont want to iterate the string field to 50 times and then store into hashtable and then pass the Key and get value…

If you know the 'n’th field that you are interested in the document list, it is simple to retrieve the value.

Keep a map step in your flow service. Drap a map between the field in document list and a string field. Click on the link and go to Properties. You can see something called ‘Indices’. Click on edit and provide the run-time value of key as %key%.

You will get the value of 'n’th field in the string field.

HTH
Senthil

Hi Senthil

This should work only if you have the Numeric and incremental “key” value.

Array[0]=Value1
Array[1]=Value2
Array[2]=Value3

What if I have array with unordered alphanumeric ‘key’.

Array[‘key1’]=Value1
Array[‘key2’]=Value2
Array[‘key3’]=Value3

Please correct me if wrong.

Thanks,
Amol.

Hi,

We can try doing using documentListToDocument service , output of which will be variable = Key and value = Value can be used to retrieve the desired value from the list.

Thanks,
Amol.

What is the objection/concern about looping over the document list until you find the entry of interest? The only technique that would be more efficient is if the entry of interest is in the same list location every time–then you can do as Senthil indicates and retrieve array[i] where i is the constant index of the entry.

But I suspect based on your description that the entry you’re interested in might appear anywhere in the list. Something, somewhere is going to have to loop over the list. Creating a hashtable or using documentListToDocument as Amol suggests will loop over the list.

If you’re after just one entry then the easiest thing to do is loop until you find the one you want. If you need to get multiple values from the list, a loop of your own is probably still the way to go.

Using pub.xml:queryXMLNode service you can extract value if you define your key field as attribute in the IS document.

Example:

<?xml version="1.0"?> VALUE1 VALUE2

create the documentlist fields in pipeline with dynamic query and map it to service queryXMLNode.

you can create XQL query in pipeline with perform variable substitution for above example

doc/Innerdoc[@name=’%inputKey%’]/value/text()

Regards,
Saravanan.E

Hi Amol,
Wondering if we can create such a document list (array with unordered alphanumeric key) in webMethods flow language?

-Senthil

Hi Senthil,

I second your opinion i tried to create though but got stuck in dynamic variable generation.

Thanks,
Amol.