How to take 2 columns in a DT and write them into one string to compare with another variable

What I have is an assign activity strAddress variable as a string and I want to extract data from 2 columns in the DT dt_veritity I used this value row.item(“GRP NAME”).ToString + ("-"c) row.item(“ADD 1”).ToString but I get an error as I need the data to read like this St. Luke’s OB/GYN A Woman’s Place - 306 S. New Street.

Then I’ll use a if and use a get text out of the application to compare the extracted get text variable to the strAddress to see if they match.

Is this the best solution?

You may try to provide more clear information, what’s the error the you get?

Can you share the data which you need to compare?

Regarding getting two columns from a datatable, that can be done using Filter datatable and mention only the required columns in Keep Column tab

Regarding the comparison:

I assume you have the address related fields separated, so you’ll have to concatenate them and then compare with the data from file.

Hi @jeff.shubzda,

try using String.Format method. It look lithe this:

String.Format("There is some text numer 1 {0} - and there is text number two {1}", TextNumberOne, TextNumberTwo)

Before using this method I recommend assiging row values into variables in order to have more clear code :slight_smile:

Sorry I guess I wasn’t clear.
I have a datatable (dt_veritity) in that table I have 2 columns (GRP NAME and ADD1)

I have to compare the data from the 2 columns to see if it matches the get text data I get from the site. So in column (GRP NAME( I have - St. Luke’s OB/GYN A Woman’s Place and in column (ADD 1) I have 306 S. New Street. In the get text aaname I have St. Luke’s OB/GYN A Woman’s Place - 306 S. New Street.

So my idea was to use assign variable strAddress but I’m not sure how to write the string out in the value? So that is looks like the get text.

So should I be using a multiple assign?

@jeff.shubzda

frankly speaking, it doesn’t matter :). Yet multiple assign looks more professional and clearer than 2 separate assign activities

So I filter the DT and only get the 2 columns I need (GRP NAME) and (ADD 1) so what can I do to get that data into a string so that is has the same format as what I’m getting out of the get text file? In that field it’s one string and uses a - as a separator. St. Luke’s OB/GYN A Woman’s Place - 306 S. New Street should I use a multiple assign and assign each a variable? or is there a way to write out a string as you mentioned as concatenated?

you are doing it correctly

that cna be done that way also

Just take the three parts of your address, store it in the variables. strPart1, strPart2, strPart3

then you are concatenate using the logic you are doing, simply using + operator to add concatenate the three variable ams adding " - " in between those three parts.

What is the issue you are facing in this approach!

can you send the actual data, the three parts of address and the actual extracted address. May ne that will help is to understand ans suggest better.

1 Like

Great, I was able to use the multiple assign and output that into a variable string, thanks for all the guidance and help.

1 Like

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