" /> ListObjects Items index updated after some modification - Genesys CTI User Forum

Author Topic: ListObjects Items index updated after some modification  (Read 4229 times)

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
ListObjects Items index updated after some modification
« on: July 08, 2013, 10:10:55 PM »
Advertisement
Hi guys,
Having an issue here...
Creating some List Objects, for example List Alpha. This list has 1 Item (Item1) and this item has 2 keys (Key1 and Key2) with values 1 and 2 respectively.
Meaning

(Index)(Key)(Value)
1. Key1 = 1
2. Key2 = 2

Now after a days customer needs to update Key1 value to 6 for example, so using IRD he does such operation.
Now the strategy stops to work as expected...

Why?

Because now if we go to the ListObject it is like this:
(Index)(Key)(Value)
1. Key2 = 2
2. Key1 = 6

The updated key appeared as Index = 2...so when I assign the variable on the strategy (remember it is done by index #) it reads correctly but also wrong as the indexes have been modified and updated in a new order...

Anybody else having this issue or knows if it is as "expected"??? Doesn't make sense to me...Seems IRD does an delete and then add at the bottom instead of an update function...

Comments please

IRD: 8.0.100.12
CfgServer: 8.0.300.30

Thanks!

PS: Checked already RN and couldn't find anything related or possibly linked to an issue like this
« Last Edit: July 08, 2013, 10:21:50 PM by cavagnaro »

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: ListObjects Items index updated after some modification
« Reply #1 on: July 09, 2013, 04:12:18 AM »
Damn it...it does a delete and then an insert on the DB but doesn't keep the original index:

[code]
01:06:33.875 Trc 04541 Message MSGCFG_CHANGEOBJECT received from 548 (InteractionRoutingDesigner 'IRD')

  MSGCFG_CHANGEOBJECT
  attr: SATRCFG_OBJECT              value:  "1850000ITEM1Key16" 
  attr: IATRCFG_OBJECTTYPE          value:  16 [CfgTransaction]
  attr: IATRCFG_REQUESTID          value:  679

<CfgTransactionUpdate
  DBID="185">
<userProperties
  action="change">
  <list_pair
    key="ITEM1">
  <str_pair
    value="6"
    key="Key1"  />
  </list_pair>
</userProperties>
</CfgTransactionUpdate>

01:06:33.875 Trc 24211 Object [CfgTransactionUpdate], DBID [185] is to be changed by client, type [InteractionRoutingDesigner], name: [IRD], user: [default]
01:06:33.875 Trc 24218 Transaction [3] is sent on execution
01:06:33.875 DBRequest, handle 209 sent, query :
BEGIN TRANSACTION

01:06:33.875 DBRequest, handle 210 sent, query :
delete from cfg_flex_prop where dbid = 6121

01:06:33.875 DBRequest, handle 211 sent, query :
insert into cfg_flex_prop (dbid, object_dbid, object_type, parent_dbid, prop_name, prop_value, prop_type, part, csid, object_csid, parent_csid) values(6121, 185, 16, 6120, 'Key1', '6', 0, 0, 0, 0, 0)

01:06:33.875 DBRequest, handle 212 sent, query :
insert into cfg_hdb_object (id,oper_type,oper_time,object_type,object_type_id,object_dbid,user_name,user_dbid) values (2098,4,1373342793,'CfgTransaction',0,185,'default',0)

01:06:33.875 DBRequest, handle 213 sent, query :
update cfg_hdb_object set object_data=BLOB DATA(236 bytes) where id=2098

01:06:33.875 DBRequest, handle 214 sent, query :
update cfg_refresh set notify_id = 2098
[/code]

Seems a bug to me...what do you think guys...I'm willing to open an eSR on this issue but would like to confirm it with your ideas

Thanks!

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: ListObjects Items index updated after some modification
« Reply #2 on: July 09, 2013, 05:09:15 AM »
Me again hehe
Solved the issue using GetStringKey function...works better.
But still think that messing with the indexes is a bad design...don't you?

Offline bublepaw

  • Sr. Member
  • ****
  • Posts: 283
  • Karma: 10
Re: ListObjects Items index updated after some modification
« Reply #3 on: July 09, 2013, 05:15:03 AM »
Hi cavagnaro,

I don't think it is bug. By design items in list object should be referenced by name. Function that allows referencing items by index is added to allow You to iterate through list - nothing more. After all this is list not array :)
« Last Edit: July 09, 2013, 06:25:17 AM by bublepaw »

Offline smile

  • Sr. Member
  • ****
  • Posts: 286
  • Karma: 6
Re: ListObjects Items index updated after some modification
« Reply #4 on: July 09, 2013, 09:41:14 AM »
why don't use ListGetDataCfg function if you know key name?

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: ListObjects Items index updated after some modification
« Reply #5 on: July 09, 2013, 04:55:52 PM »
¬¬ ¬¬ ¬¬
Damn it! I hate myself lol
I was following the doc a Genesys guy "taught" me...and he assured me only method was using index number...I took it as "law"...
Now reading well the function definition never says something like that....
Rule #1: Never trust Genesys "experts"...
Rule #2: Read the damn documentation lol slap for me :P

Thanks guys! Made my day  8)
« Last Edit: July 09, 2013, 09:43:21 PM by cavagnaro »