" /> How to format ListGetString to get info from a nested list? - Genesys CTI User Forum

Author Topic: How to format ListGetString to get info from a nested list?  (Read 3300 times)

Offline nonny

  • Full Member
  • ***
  • Posts: 218
  • Karma: 2
How to format ListGetString to get info from a nested list?
« on: September 18, 2015, 05:53:23 AM »
Advertisement
If I have a list that contains a "sub-list", what is the correct key syntax to be able to access items in that sub-list using ListGetString (IRD)?  Is it as simple passing in 1.1, Key.SubKey?

Offline terry

  • Sr. Member
  • ****
  • Posts: 328
  • Karma: 35
Re: How to format ListGetString to get info from a nested list?
« Reply #1 on: September 19, 2015, 06:31:39 PM »
Yes

Offline nonny

  • Full Member
  • ***
  • Posts: 218
  • Karma: 2
Re: How to format ListGetString to get info from a nested list?
« Reply #2 on: September 29, 2015, 10:51:55 PM »
This isn't working.  Just getting a blank list variable.  Should I be using some other function?

Offline terry

  • Sr. Member
  • ****
  • Posts: 328
  • Karma: 35
Re: How to format ListGetString to get info from a nested list?
« Reply #3 on: September 30, 2015, 03:20:33 AM »
GetStringKey['key.subkey', list]

Offline nonny

  • Full Member
  • ***
  • Posts: 218
  • Karma: 2
Re: How to format ListGetString to get info from a nested list?
« Reply #4 on: September 30, 2015, 04:22:04 AM »
That's not working either.  I've tried the keyname.subkeyname and the keyinteger.subkeyinteger but each time I just get an empty value back.

If it helps, here is the list variable contents:

  _I_I_007802703976d02c [09:04] ASSIGN: var_ws02_results_list(LOCAL) <- LIST: {
              "accountId" : "100001301",
              "type" : "1",
              "category" : "2",
              "profile":{
                "title":"MR",
                "firstName":"TEST",
                "lastName":"USER",
                "email": "",
                "phone":"7 573-5555",
                "businessPhone":"",
                "mobile":"",
                "serviceAddress":"    87 SOMEWHERE AVE\n\nTHE TOWN  3119",
                "billingAddress":"87 SOMEWHERE AVE\nTHE TOWN 3119\n\n"
                },
              "statement":{
                "balance":0,
                "dateDue":"2013-12-05T00:00:00.000+13:00",
                "inArrears":false,
                "inCreditControl":false
              }       
              }

Offline terry

  • Sr. Member
  • ****
  • Posts: 328
  • Karma: 35
Re: How to format ListGetString to get info from a nested list?
« Reply #5 on: September 30, 2015, 08:38:03 PM »
Not sure how you make URS to print list in JSON format, usually it uses other way to present lists.
What version you using and do you play in strategy with run time modes (SetRunTimeMode function, run_time_mode option) specifcally with values 128, 1024?

In any way I don't think regular List functions understand JSON.
If JSON is involved you probably can try KVList functions, something like
KVListGetStringValue[var_ws02_results_list, 'profile.firstName']





Offline nonny

  • Full Member
  • ***
  • Posts: 218
  • Karma: 2
Re: How to format ListGetString to get info from a nested list?
« Reply #6 on: September 30, 2015, 09:26:18 PM »
The list is populated from a REST API Web Service - assigned to a List variable.

Offline terry

  • Sr. Member
  • ****
  • Posts: 328
  • Karma: 35
Re: How to format ListGetString to get info from a nested list?
« Reply #7 on: October 01, 2015, 12:59:19 AM »
Up to my knowledge source of list object doesn't matter.
If strategy doesn't play with run time modes then both
"GetStringKey" and KVListGetStringValue should work.
If it plays then it depends from which exactly modes are used.