Is the switch activity suitable here? (Output depending on range of number input)


in my automation a cell value of an excel file determines which string to write in SAP.

If the cell value is 1200 → type into SAP “ABCD1200”
If the cell value is 1250 → type into SAP “ABCD1200”
If the cell value is 1450 → type into SAP “ABCD1400”
If the cell value is 2650 → type into SAP “XYZ2600”

and so on. I have about 40 different cases.

How would you solve that? I am thinking to use an Excel macro but maybe there is an easier way in Studio.

Hope this makes sense!

Thanks in advance

Hello @Pokri,

You could build a table with code and type into SAP. Get the input(from cell value) and search this input in the table. Then get the type into SAP.

Hope it helps!

Thanks for the quick response,

I am not sure how to do that, I’ll give some detailed info:

these are some of the values to choose from in SAP:

AT1000 Wien
AT1100 Wien
AT1150 Wien
AT1200 Wien
AT1230 Wien
AT1300 Wien

One of those values should be chosen in SAP depending on the cell value (= ZIP code) in excel.
A ZIP code like “1050” should have “AT1000 Wien” as result , a ZIP code of “1180” should have “AT1150 Wien” as result.

Then you need an input datatable like:

Zip Code | SAP

1050 | AT1000
1180 | AT1150

An other way would be in Studio:

If activities that contains for example:

If mycellvalue = “1050” orElse mycellvalue = “xxxx” orElse mycellvalue = “xxxx” … Then go to SAP and type AT1000; Else: another if condition with mycellvalue = “yyyy” orElse …

In this way, you are filtering your data and typing in SAP what you need. The issue here is that maybe you are going to have too many conditionals. That’s why I said building a datatable with two columns.

Ah now I get it! Thank you, a table will be do the job! :slight_smile:

1 Like

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