Finding a String in an Array

Sorry if this is a silly question but I am still learning. :slight_smile:

I have a queue item coming into a process. I am going to cycle that item thru a datatable to see if there is a match.

Problem is, the item string coming in does not match the string I need to compare to in the datatable. For instance, the queue item comes in as “Zip” and I need to match it to the value “Zip Code” in the datatable. I will have multiple match options like “Zip Code, Country, State” etc

The item coming in via the queue will be variable

When I come in with my queue item it might be “zip” or “st” or “co”, etc. I need marry it up to my list/array mentioned above.

Would appreciate any hints. Thanks!

If the string you’re getting is part of the column name, you could iterate over DT.Columns and find the name which Contains “zip”, “st”, etc., and set that column as the one you want to search.

That’s a good idea but in my actual usage, the item doesn’t contain the same character string as the field in the datatable.

There must be an identifier for determining which column to search, or else you’re going to have to search every field in the data table, iterating over your columns and rows.

maybe you can add alias column name for zip as zp, state as st,… and filter based on the value.

Thank you for all the responses. This is how I ended up doing this:

I made a list of items in the Config file that had the string name coming in from the queue and what I wanted to convert to.

As an example:

Name - Value
zip - zip code
st - state

Let’s say the Name field is coming in as a variable called “Code” from the Queue.

Do an Assign to the value coming in from the queue via in_TransactionItem
strQueCode = in_TransactionItem.SpecificContent(“Code”).ToString

Then Another Assign
strSrchCode = in_Config(“strQueCode”).ToString

Now I have a search variable (strSrchCode) that will give me the value “zip code” or “state” or whatever to use in my table search.

This seems to work well and, for me at least, is clean and simple to understand. :grinning:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.