How to use else-if or multiple if - other than nested if

Hi guys,

I am working in a use case where i have to use multiple if statements or else-if statements . i know the method of nested if and switch. but it takes so longer time to execute. Is any other logic is there work on this. it should be faster execution Try-Catch also takes so many time.

Thanks in Advance,

Regards,
Sriram

@Sriram07

As you said, your process involves more IF-Else conditions. For this, am suggesting to use Swich activity.

And also could you please tell what you are doing here. Based on that we can suggest which activity you can use here.

I have a extracted paragraph from get OCR text. then i need to check a word of state name using contains(Say karnataka) if its is karnataka i have to invoke one workflow for that state to process that doc type , like wise i have 250 states and respective 250 workflows actually this part is done .

Now the problem is checking the state name in a extracted paragraph in all documents.Here i have to use multiple if to check.

And tell me how can i achieve using Switch activity. if you have any workflows share with me with 5 states name is enough!

Thanks

@Sriram07

instead of that u have one simple solution

  1. extract state name from paragraph and assign a variable ex state

  2. 250 workflow give the proper name like State name

  3. just use one invoke workflow pass the state variable name in invoke workflow path

    method2:

    using For each

    assign all 250 state name in config file

    inside for each put one if condition check state name.contains(item.tostring) state name, if
    true invoke one
    workflow
    pass the variable in invoke workflow

1 Like

@amaresan

I am not able to understand those 2 methods also.
1. 250 workflow give the proper name like State name
2. just use one invoke workflow pass the state variable name in invoke workflow path-not understood these steps
sorry, please can you make me to understand with step by step in details,
If you can share me the workflows with same use case of minimum 5 states please!!
I need to solve this @amaresan.

Thanks

Hi @sriram07

For your problem you have two option

  1. one is. you had 250 workflow rights?..For that 250 workflow u have to give name right… i hope u gaved the proper state name for 250 workflow.

if you will extracted state name from paragraph then… just store a variable. think like the variable name as State Name. Just use one invoke workflow …Path as ur path+stateName(variable name)+.xaml ex: “C:"+StateName+”.xaml"

method 2
Using For each Method
1.Put All 250 State name in one key Value in Config file(separated by comma)
ex: keyname is “StateNames” Value is (Tn,kerala,…etc)

2.Read the particular key Split based on comma and then assign as Array

3.put for each activity in Value field put Array variable. Set type as String
4. inside for each put if condition, the condition is urStringvariable(which is extracted from paragraph).contains(item.tostring)

  1. then part just use invoke workflow activity in that give normal path+item.tostring+“.xaml”

example “c:”+item.tostring+“.xaml”

i hope it make u clear

1 Like

Thanks you so much @amaresan
I’m good now!!!
Cheers!
let you know if another help i needed regarding this use-case!

@Sriram07

if this is solved ur problem … mark as solution it helps others…

thank u

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