Issue with Add Data Row, repeating the data in the DT

HI there,

I am facing an issue with Add Data Row.
In my scenario I have to check for the field, weather its present or not then have to take action accordingly, so on the 1st IF statement its working fine but in next IF’s instead to writing the data to same row it is generating/writing the data in a new row.
below is the screenshot of the output, its duplicating the data, whereas I am looking for data to be in 1 row than in multiple.

expected output

screenshot of the code from UiPath, here you can see the IF statement I have written and used Add Data Row

Hi @indrajit.shah

At last use Clear Data table activity and Pass the Dt name

Regards
Gokul

@Gokul001 , where are you suggesting using the Clear DT? after all the IF statements? or after the last IF statement?

Here :

Regards
Gokul

I did, and it’s clearing all the data from the DT and result is blank

Can you explain the flow? You have done it wrongly i think so. @indrajit.shah

In both the If condition you have used Add Data Row activity that why you have duplicated data in the excel file?

Regards
Gokul

Sure,

So, my input is a JSON, and by using Build DT, I have created headers for my data-table, and after desterilizing, I am looping in for each, in that I have assigned some variables, to get the values but some of the tags are missing in json, for that I have used If condition’s to check, if that tags are present or not, if not then put some predefined value to that field and populate the data along with that and if present then get the value from the json only and populate rest of the row data, like that I have put multiple IF condition’s.

Hope I am able to explain myself.

Hi @indrajit.shah

Remove all the add data row activity and use only one add data row activity at the last of if condition

Regards
Gokul

1 Like

Refer the screenshot

Regards
Gokul

aha!
thank you very much, that will work, I understand root cause of it.

btw, can you help me with one more thing, the input json field for effectiveDate have values of like this

2022-08-24T00:00:00.000+0000

but in my output its coming like this, whereas in build DT the column data type is selected as string.

08/24/2022 05:30:00

Can you create new topic for this queries @indrajit.shah. It will confuse other user too who are look for the same issue

Kindly mark it as solved
.

sure, can you have a look on the topic.
Value gets changed from actual - Help / Studio - UiPath Community Forum

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