How to add (string variable) data to excel column 5?

Hello @Hashim_Shamsudeen

It is running fine, Thanks :hugs: :slightly_smiling_face:

2 Likes

You are welcome

But there are headers im trying to rewrite code… But it is Item, so i could nt add headers in code

Yes, please change the code as per your requirements.

Hi @Hashim_Shamsudeen
I’m getting this error for written code.

Buddy, please carefully read my last response. I already mentioned in my previous comment the reasons for this exception. In your excel sheet there few place where the Amount is empty and some places the amount provided as range.

Yeah i have read and seen it, I have referred other forum post’s and changed the convert to INt32 from Decimal, but still im getting same error.

1 Like

Can you print the value of the if condition(left hand side) just before the if and see what you get.
As @Hashim_Shamsudeen pointed there are times when you can have empty value then the convert will not work.
In this case you can use a one line assign just before If to convert empty entries to 0 so that you do not get any format error (it wont work if you use Decimal or Int32)

Hi @nadim.warsi
It is displaying same error as Input string was not in a correct format

just print the value and not the conversion.
Print the row.Item(2).ToString.Replace("$","").Trim.Replace(" ","."))

It is working when i have assigned in Assign activity, but it is not writing for all cells in excel, it is appending upto 270 cells but there are nearly 460 cells in excel.
How to write range of 0.00 to 5.00 in IF Condition.

Please, check the picture and suggest me if any changes to be done.Screenshot%20(293)

You can either convert to int or decimal but the string you are trying to convert is empty or values like "$ 3 99-$ 12 99 " it will throw error. Please let me what we should when the amount field is empty and when we have amount values in range like "$ 3 99-$ 12 99 "?

Hi Shiva,
Please check the attached workflow. TestWorkflow.zip (27.1 KB)

I have made a few changes. As I told you earlier empty amount field and amount specified in a range breaking your code. I have added a check before converting the string to a decimal/integer. That is, if the amount field is empty I’m considering it as zero and if the amount field has values in a range($3 04 -$12 01) I’m considering the max value of the range(In this case $12 01 I have considered) and generating the status accordingly. You can change the condition based on your requirements and run the workflow. I hope solves your problem

2 Likes

Hi All,

@Hashim_Shamsudeen, your sequence is running fine ! Thanks :hugs::star_struck: for it, but if headers are there it is throughing an error like … Input string is not found.
Can you please check this sequence, it is just appending Cheap and expensive not entering into Medium range. Please let me know what change i need make.
Data Append.zip (28.7 KB)

It’s a small fix buddy. Just tell your read excel activity that your sheet have first line as header by checking add header property. As you requested I have made the changes in your workflow. I have removed Add column activity expecting that the column “Action Required” already there in the sheet. Please find the attachment. Data Append.zip (28.2 KB)

1 Like

Yeah it is running now. Thanks @Hashim_Shamsudeen :star_struck:

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