Any idea how to implement below scenario in ab initio.

how to use the value of ‘i’ from ‘for’ loop to concat and create the name of input fields and use them in a ‘if’ logic inside for_loop.

I have used string_concat but ‘i’ value is not getting assigned .

Below is my code

for(let int i=1, i< in.no_of_loop)
begin
If(string_substring(string_concat(“in.”,“field”,(string(“”)) i),1,2)=‘AP’)
V_temp =“M”;
Else
V_temp = “N”;
End

I want the if condition will resolve like below

For 1st iteration i=1:

If(string_substring(in.field1,1,2)=“AP”)

For 2nd iteration i=2:

If(string_substring(in.field2,1,2)=“AP”)
.
.
.

And so on till the value of ‘i’

2 Spice ups

First, welcome to the community!

Next, I’m assuming that Ab Initio is a specific product/platform you’re working with? Can you tell us a bit about what your end result is supposed to look like?

The end result of if condition will look like below

For 1st iteration i=1:

If(string_substring(in.field1,1,2)=“AP”)

For 2nd iteration i=2:

If(string_substring(in.field2,1,2)=“AP”)

field1 and field2 names should be generated using the string_concat or any other function

1 Spice up

So what is this part supposed to be doing?: (string(“”)) i
I suspect a typo there…

1 Spice up