How to create a dynamic if-else statment

I have two columns



One is Template Keywords, and other is Template IDs
Template IDs include the type we need to display when we detect the keyword inside the given data
So, for example we can detect if the template is template 1 if Account number(BBAN) is present in it and similarly template 2 if Instrument ID is present in it.

I have the logic but I don’t know how to do it

1 Like

Not totally sure what the goal is, but a good rule of thumb is to check all the false conditions first, and then handle the true case. Sometimes nesting if else blocks may help get what you want.

2 Likes

Can you tell me how can I get desired output?

1 Like

So you want the value of ‘Template 1’ returned from the ID array if something finds ‘Account Number’ in the Keyword array, because they are both in position 1 in both arrays? How are you determining that something is found in the Keyword array? Are the array items always in a consistent order? Where are the Lookups coming from? I think we need a lot more information to determine what you need. It seems to me that something is being made more complicated than it needs to be.

2 Likes

I have a Templates table that includes all the information related to each specific template. I’m using a lookup to fetch the entire template. Then, I extract all of its IDs and the specific keywords associated with it.

Each template has unique keywords — for example, a keyword in Template 1 won’t appear in Template 2 or 3. What I want to do is create a conditional statement. For instance, if the detected template is Template 1 and it includes the keyword “Account Number”, then a specific action should be triggered.

So, I’m trying to figure out the best approach to implement this logic. What would be the most effective way to handle this

1 Like

I think that just confused me more. I’m not understanding the entire flow and what the data looks like.

2 Likes


This is how the templates table looks like

1 Like

Thanks for the help guys, I have got it working using a json Object and then using javascript

1 Like