I have a large number of conditions in Excel that i want to use in a series of IF Activities.
Is it possible that instead of adding the conditions directly into the IF Activity i could read the excel file as a data table and take the conditions from there?
Test.xaml (10.9 KB)
Conditions.xlsx (7.9 KB)
Additionally it would be good if i could do this either within a for each row or setup individual IF activities.
yes buddy @jon1302 you can get from a excel with if condition and assign it to a variable and you were going good budy
Here is your xaml and its resolved
Changes made were
1.converted the type stConditionValue to boolean from generic as it would be esy to pass in if condition as if will take only boolean
stConditionValue = Convert.ToBoolean(row(“Value”).ToString)
2. And add the if condition in the first for each row itself buddy
Test.xaml (9.5 KB)
Kindly let know whether this works or not buddy and if it gets resolved kindly close the topic with the comment marked as solution that could help others looking for ideas under your topic buddy @jon1302
Is that working buddy @jon1302
Encountered an error when i run it:
Buddy just pass it as GENERIC TYPE itself buddy @jon1302 remove the Convert.ToBoolean in front and change the variable type down in variable panel buddy @jon1302
The reason the i thought the GENERIC TYPE of either TRUE or FALSE can only be converted to boolean but we have string in excel like strSupplierTitle.Replace(" LTD"," LIMITED") = strCompanyName, so thats y, i didn’t notice the excel file attached and thought you were passing boolean value directly, sorry my bad,
This would work buddy @jon1302
Thanks, ill give it a go. Though if i enter the stConditionValue it still recognizes as a string and not a boolean and so errors. I think i may have a different way doing the calculations in excel.
No buddy @jon1302, actually it will take as boolean, the reason is we are using conditional operators (<,>,<=,>=,=) between two strings in excel, so the output would be of boolean type only and if condition can take that value…
The reason why i asked to keep the variable of stConditionValue as generic is it can take any value of type like string,integer and boolean as well, so its better to be in generic and it will be accepted in if condition as well
I tried with certain conditions and it worked buddy @jon1302
Cheers …lets try this and sort this out buddy
try datatable filter activity . and save it to other data table will help to reduce your if else condition.
is that working buddy @jon1302
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.