input :- test1 : "CRIS3-AB; CRIS3-AB; ; ; SOECS; SOECS; ; ", test2 : "; ; Related FOX; Related FOX; ; ; Trace; Trace", Desire output : " CRIS3-AB;CRIS3-AB;Related FOX; Related FOX; SOECS; SOECS; Trace; Trace"

There are 2 local variable:

local!test1 : "CRIS3-AB; CRIS3-AB; ; ; SOECS; SOECS; ; ",

local!test2 : "; ; Related FOX; Related FOX; ; ; Trace; Trace",

If no value available before semicolon symbol of local!test2 then a value from local!test1 should take place

Desire output : " CRIS3-AB;CRIS3-AB;Related FOX; Related FOX; SOECS; SOECS; Trace; Trace"

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    Hi  ,

    You can try this code

    a!localVariables(
      local!test1 : "CRIS3-AB; CRIS3-AB; ; ; SOECS; SOECS; ;",
      local!test2 : "; ; Related FOX; Related FOX; ; ; Trace; Trace",
      local!array1:reject(fn!isnull,split(local!test1,";")),
      local!array2:reject(fn!isnull,split(local!test2,";")),
      a!forEach(
        items: enumerate(length(local!array1))+1,
        expression: if(
          a!isNotNullOrEmpty(trim(local!array1[fv!index])),
          local!array1[fv!index],
          local!array2[fv!index]
        )
      )
    )

Reply
  • 0
    Certified Associate Developer

    Hi  ,

    You can try this code

    a!localVariables(
      local!test1 : "CRIS3-AB; CRIS3-AB; ; ; SOECS; SOECS; ;",
      local!test2 : "; ; Related FOX; Related FOX; ; ; Trace; Trace",
      local!array1:reject(fn!isnull,split(local!test1,";")),
      local!array2:reject(fn!isnull,split(local!test2,";")),
      a!forEach(
        items: enumerate(length(local!array1))+1,
        expression: if(
          a!isNotNullOrEmpty(trim(local!array1[fv!index])),
          local!array1[fv!index],
          local!array2[fv!index]
        )
      )
    )

Children
No Data