Skip to main content
felixr
October 13, 2022
Solved

is there any way of updating a variable just if a reference varible change and is not null ?

  • October 13, 2022
  • 5 replies
  • 1 view


foreach(items:local:lines,expresion:
local!searchsection:
      if(
        or(lower(left(trim(fv!item),7 ) ) = "section",
        regexmatch("\d{1,2}[.]\d{1,2}",
        left(trim(fv!item),5 )

        ))


      ,

        "Section: "& cleanwith(left(trim(fv!item),12 ), "1234567890.")
      
      ,{})

      ,
      local!section:a!refreshVariable(


        value:  local!searchsection

        ,refreshOnReferencedVarChange:
        if(
          rule!NPA_isEmpty(local!searchsection),
          false(),
          true()
        )
      ),
       local!section
      )

I'm trying to modify  the second variable just if the first variable that i  have is not null but  if it is  null i need to  keep the last value the variable had

    Best answer by felixr

    Hi [mention:126a676c85024855948336691b0a7b92:e9ed411860ed4f2ba0265705b8793d05] thanks for helping me today i found a work around    to do this   with   a process model

    just making another list    and looping  this way cause if i try to loop  by the  config in multiple instances  of this node the variable don't update   correctly.  but  looping with a xor   till we get to the limit  we can update the  variable each time with no problem.

    it  was about  generating a file searching for some  key phrases and  displaying  in which section it was found.

    5 replies

    felixr
    felixrAuthor
    October 13, 2022

    let me explain a little bit better i'm looping into some  lines   each of those  lines are inside a section but a section   could start in any line  and i want  to know  which line is part of which   section  when i find a section number i want  to be able to keep it  until we get to capture the next section number.

    stefanhelzle0001
    Brainy
    October 14, 2022

    In Appian Expressions, variable values cannot be changed once assigned. In interfaces, this is possible only on user interaction.

    Is this only about displaying these sections dynamically? Then, you could show the section header only if you found a section in that line.

    felixr
    felixrAuthorAnswer
    October 14, 2022

    Hi [mention:126a676c85024855948336691b0a7b92:e9ed411860ed4f2ba0265705b8793d05] thanks for helping me today i found a work around    to do this   with   a process model

    just making another list    and looping  this way cause if i try to loop  by the  config in multiple instances  of this node the variable don't update   correctly.  but  looping with a xor   till we get to the limit  we can update the  variable each time with no problem.

    it  was about  generating a file searching for some  key phrases and  displaying  in which section it was found.