Dynamic Variable Name



  • Hey guys, how can I have a dynamic variable name for a parse block that is in a loop ?

    #InfoBlock PARSE "<SOURCE>" REGEX "Infos='({\"id\":.*?})" "[1]" Recursive=TRUE -> VAR "InfoBlock" 
    
    UTILITY List "InfoBlock" Length -> VAR "LEN" 
    
    SET VAR "INDEX" "0"
    WHILE "<INDEX>" LessThan "<LEN>"
    #Info PARSE "<AllAddresses[<INDEX>]>" REGEX "{\"id\":.*?,\"full_name\":\"(.*?)\",\"mobile_phone\":\"(.*?)\"" "[1] [2]" CreateEmpty=FALSE -> CAP "Info_<INDEX>" 
    
    FUNCTION Compute "<INDEX>+1" -> VAR "INDEX" 
    
    ENDWHILE
    

    My problem is in -> CAP "Info_<INDEX>" section

    I expect something like "Info_0" and "Info_1", but it only gives me one result with the name "Info_<INDEX>"

    I'm currently using OB v1.2.2 (latest by current date)



  • Currently I used an alternative which is

    #Info PARSE "<AllAddresses[<INDEX>]>" REGEX "{\"id\":.*?,\"full_name\":\"(.*?)\",\"mobile_phone\":\"(.*?)\"" "[1] [2]" CreateEmpty=FALSE -> VAR "Info"
    
    SET CAP "Info_<INDEX>" "<Info>"
    

    It works but I'm looking forward to see what is the problem with first one


Log in to reply