Regarding Extract Function

Hi,

I have  a local variable that holds data like this.

local!data:[id:122,month:12,numberofdays:2]; [id:123,month:1,numberofdays:4]; [id:124,month:12,numberofdays:6]; 

while extracting the "numberofdays"  from the above format  by using extract function like this

local!january:extract(local!data,"month:1,numberofdays:","]") 

I am getting this error.please check this image.

 

Your suggestions are valuable

 

Thanks and Regards,

Divya

  Discussion posts and replies are publicly visible

Parents Reply Children
  • load(
      local!data: tostring(
        {
          {
            id: 122,
            month: 12,
            numberofdays: 2
          },
          {
            id: 123,
            month: 1,
            numberofdays: 4
          },
          {
            id: 124,
            month: 12,
            numberofdays: 6
          }
        }
      ),
      local!january: extract(
        local!data,
        "month:1,numberofdays:",
        "]"
      ),
      local!january
    )

    Hi Divya,

    In case you are using the extract function, you have to convert the local variable into the string before extracting to get the desired result as mentioned by Carlos.  

    Please find the code for the same. Its working for me as well.

    Thanks

    Aditya