Retrieving value "100%" from the lookup data table cell

Hi All,

I am using Look up Data Table and my target lookup column has the values 100%, 50%, and blank. I want to print the same value in my target column. Pl. guide.

My receiving variable is of generic type but I only get the value 1 in the cell instead of 100%.


why cant we go with for each for your requirement ?

Lookup datatable does not return value as output it gives only index of the particular value

Hi @Dr_Raza_Abidi_PhD ,

i think Lookup data table activity is not needed. we can go for simple excel formula.

For suppose A column having the percentages so we have to copy the same values to the B column. please follow below steps and let us know. thanks

  1. Use excel application scope to open excel file and inside use read range to get the whole data into data table. use the below expression to get the row count.

RowCount = YourDT.rows.count

  1. Use write cell activity and input cell β†’ B2 Value-> =A2

  2. Now use Auto fill Range and source range β†’ B2
    Fill range β†’ B2:B+RowCount

In math, 1 means 100% - it’s really 1.00 and then 0.90 is 90 percent etc

Multiply by 100 to get it in percentage format.

I assume your value in your DT comes from excel? If that contains a cell with x% and you read it into a generic value, x is the percentage of 1. So 50% = 0.5, and as you noticed, 100% = 1.

Try extracting the data as a string instead of a generic value, and see if the format is correct.

If not, plan B is some ugly string operation.
Lets say:
[generic] myValue = 1 (as in 100%)
assign: MyValuePercentage = (double.parse(myValue) * 100).toString + "%"

This turns 1 into β€œ100%”, 0.5 into β€œ50%” etc…

1 Like

Thanks a lot @Jeroen_van_Loon for your swift response. Plan B became successful :grinning: and issue is resolved now.

Many thanks and kind regards,

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