Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Duplicate Item key?

edited March 2016 in SRP Tree Control
If I use strings as item keys, SendItems event generates duplicate item key.
Please find my attached video.

Comments

  • I'm having trouble duplicating this issue. I even debugged the SendItems code, and it always does a check to see if the given key exists before adding the new item. Can you explain what you mean by "use strings as item keys"? Was there situation in which this was working correctly but then changing the keys stopped working? What happens if you remove all spaces from your keys? Will it work then?
  • Ariel,

    Also, please confirm the version of your control.
  • edited March 2016
    Hi, I am using SRPControls_401RC3.
    I tried to use numbers as item keys, and it works fine. It fails if I set the keys to alphabetic format. It also fails if I remove the spaces from the keys.
    Thanks, Ariel
  • I'm afraid this leaves me at square one. Can you post the code you use to set up the tree? Maybe there's a property setting somewhere that triggers this condition.
  • edited March 2018
    Hi Kevin,

    Here comes the code.

    searchCriteria = rpf< RETR_CRITERIA_RPF$> searchPath = rpf< RETR_DATA_PATH_RPF$> jointTable = rpf< RETR_JOINED_FILE_RPF$> validPattern = rpf< RETR_VALIDATION_RPF$> no.of.criteria = dCount( searchCriteria, @vm) old.criteria = '' for i = 1 to no.of.criteria otherInfo = searchPath< 1, i> :@svm: jointTable< 1, i> :@svm: validPattern< 1, i> old.criteria< i> = 1 :@vm: searchCriteria<1, i> :@vm: searchCriteria<1, i> :@vm:@vm:otherInfo next i call set_property( @window:".OLD_CRITERIA", "OLE.ItemList", old.criteria)

    I tried to use old.criteria< i> = 1 :@vm: i :@vm: searchCriteria<1, i> :@vm:@vm:otherInfo instead and it works well, but for some further reasons I have to use searchCriteria<1, i> for the item keys.

    Thanks,
    Ariel
  • Could searchCriteria possibly have some delimiters in there that may not be easily visible within the debugger?
    I'm thinking carriage returns or something for example?
  • I think Mark's suggestion is worth looking into. If, however, you confirm that delimiters are not sneaking in, then I will ask you to create an RDK that I can run (that does not depend on application specific code or tables). This requires a little effort on your end, but it is the most efficient way to get the issue reproduced on my end. Many times, the effort of creating a stand-alone RDK reveals the root cause of the issue.
  • Hmm, there's no delimiters in the keys.
    I created a simple RDK to look at, please find the attached file.

    Thank you, Ariel
  • edited March 2016
    Thanks a ton. The RDK quickly revealed my myopia. I was looking for oddities in the keys, but never tested keys with lower case letters. Internally, the SRP Tree stores keys in upper case. The SendItems method wasn't making your keys upper case before checking to see if the item already existed. It's a bit shameful I didn't think to check this; as a creature of habit, all my code uses upper case keys.

    At any rate, you are free to download version 4.0.1 RC4 to confirm that it works on your end.
  • Was that an RDK or an rdk that helped resolve the problem?
  • Thanks for this Kevin. I will go for this version.

    Cheers, Ariel
Sign In or Register to comment.