Assign Activity Data Table Result

I am using a SQL Query to pull 1 cell. If there is data it will pull ‘WFM_DATE_PROCESSING’ if it is empty, it will be null. I think I am then assigning that to a data table named dt_res. I then want to assign what is found to TRANS. Then if Trans has ‘WFM_DATE_PROCESSING’ in it, I want to open a Macro.

I think the problem I am having is getting the TRANS to be assigned what is in the dt_res table. Can you help me?

Hi @sjshuster,

You need to first confirm what is the output of the SQL Query.
If you receive a string, you need to change the dt_res type to String instead of a DT.

If its a string you can directly check its value after assigning it to TRANS.

If the return of the SQL Query is a DT then you need to find out which column contains the value ‘WFM_DATE_PROCESSING’

Question, are you expecting just one row in return or multiple?

Please specify the return from SQL.

Hi @songoel ,

It is supposed to be a string, Either a null cell or a cell that says “WFM_DATE_PROCESSING”. So I took the dt_res out of the DataTable property and I changed the Variable to a string. Then I was able to set the Assign Trans=dt_res. But it is not proceeding to the If statement and opening the Macro. So I am assuming it was not passing the words “WFM_DATE_Processing”?

@sjshuster Use Assign TRANS = dt_res.rows.item(0)(0).ToString

@Pravin_Patil1 it is giving me a compiler error saying that ‘rows’ is not a member of ‘String’.

Change dt_Res from string to Datatable

Thank you @Pravin_Patil1 . That was the trick.

I know this is a separate question, but where is the best place to get the knowledge of how to do these things? Are the tutorials the best place?

I am flying blind and have to keep asking silly questions on here.

You just need to follow UiPath training video along with practice assignments…Otherwise everything will come with experience…
You can mark the comment as solution

Thank you and marked as solution!

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