Value of string cannot be converted

I am using for each row in data table where under assign activity I am passing

Account=CurrentRow(0).to string

And then passing Account.toString in the application (which is working fine)

But, when I am trying to get the output in a CSV (not excel) it’s giving error

I am adding an assign activity

change = Account where change is arrey of string

Getting error

I am doing another For Each Row in Datatable

Can anyone suggest what should I do so that output CSV pastes multiple accounts after iteration

If anyone can provide a screenshot of xaml it will be more helpful,:pray:

1 Like

@dipon1112000

you cannot assign a string to array of string

one way to assign is change = {account}

but not sure if this solves your other issues…the explanation is little off

if you have a datatable then dt

cheers

1 Like

I did the change now I am getting another error

1 Like

@dipon1112000

looks like inside loop you modified the datatable.

not sure what you are trying to edit

you cannot add more rows to a datatable inside the for loop of same table

cheers

1 Like

Hi @dipon1112000

Try this in Assign Activity

Change = Change.Concat({Account}).ToArray

Hope it will helps you :slight_smile:
Cheers!!

1 Like

@dipon1112000

Could you please provide the XAML file? Once we review it, we’ll have a clearer understanding of your requirements and can work on resolving the issue for you

1 Like

I am now getting an error

I don’t know what to do

The steps I performed are

  1. Read CSV (datatable dt1)
  2. Build Datatable (dt2)
  3. For Each Row in Datatable
  4. Get Row item (account)
  5. Under for each row Added assign activity
  6. Account= CurrentRow(0).toString
  7. Type into activity (Account.toString)
  8. Downloding pdf
  9. Doing extraction with regex

All the activities are working

Now I am trying to get the extracted data to CSV (not excel)

So I am doing

  1. Assign activity
    Change= {Account} as I need to get all the account number used in the iteration

  2. For Each Row activity under which I am using If condition
    Condition is change.length=0
    Under Then i am using 2 assign activity
    Account= change(0)
    Change=change.toArray()

  3. Add data row
    ArrayRow {Account}

  4. Write csv

1 Like

@dipon1112000

Try this:

IF(Change IsNot Nothing,Change.Concat({Account}).ToArray,{Account})

Try the code provided by Nawazish Ahmad. It should work.

IF(Change IsNot Nothing,Change.Concat({Account}).ToArray,{Account})

1 Like

Tried now getting another error

I don’t understand why ? as dt1 is working when I am running Account.toString as I am able to open multiple pdf and do download.

But it’s failing when I am trying to get the iterated account.

Can anyone help pls :pray:

Hi @dipon1112000,

‘Object reference not set to an instance of an object’ means that the variable you are using is null. Please check that your datatable is being read in correctly.

Hi @dipon1112000

Try below approach:

  1. Build Data Table with DT2 (I have use here 3 Column only)
    image

  1. You Must Store your all value in some variables like below Plan, Price etc
  2. In use Add Data Row Activity Pass like below

{Current Row(“Account”).ToString,Plan,Price}



** Pass all the variable with comma separated, in ArrayRow same number as DT2 build datatble column.
4. Use Write CSV Activity with Datatable DT2.

Hope it’ll helps you :slight_smile:
Cheers!!

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