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


Why in the following code does Locate set Pos to 1 but SRP_LIst returns 0?

Function Test(Null)
Declare Function SRP_LIST
DataTxt = "":@VM:""
Locate "" In DataTxt Using @Vm Setting Pos Then Null

SRP_Data = SRP_List("Create", DataTxt)
DataTxt = SRP_List("GetVariable", SRP_Data)
Pos = SRP_List("Locate", SRP_Data, "")
Call SRP_List("Release", SRP_Data)



  • It's because "" is not in your list. Your list has one element whose value is "":@VM:"". You need to pass @VM as the delimiter in your "Create" call.

    SRP_Data = SRP_List("Create", DataTxt, @VM)
  • Well that's an easy solution. Thank you.
  • edited October 2020
    Thanks for the help Kevin.

    Why in the below code does Locate return 1 but SRP_List return 0? Is it the same issue? How do I pull data from a FastArray and make the below work?

    Separate question, while in the debugger, why can I not modify NewData

    Function Test(Null)
    Declare Function Srp_List, SRP_FastArray

    DataTxt = ""
    DataTxt<1> = "1"
    DataTxt<2,1> = ""
    DataTxt<2,2> = ""
    DataTxt<3> = "3"

    Srp_Fast_Data = SRP_FastArray("Create", DataTxt)
    Srp_List_Data = SRP_List("CreateFromFastArray", Srp_Fast_Data, 2, 0)

    NewDataTxt = SRP_List("GetVariable", Srp_List_Data, @VM)

    Locate "" In NewDataTxt Using @VM Setting Pos Then Null
    Pos = SRP_List("Locate", SRP_Data, "")

    Call SRP_List("Release", Srp_List_Data)
    Call SRP_FastArray("Release", Srp_Fast_Data)
  • Because SRP_Data is unassigned? I think you meant to pass SRP_List_Data.
  • Well that's correct however after making that change SRP_List returns 2 not 1, why?

    Also a separate question, while in the debugger, why can I not modify NewDataTxt?
  • That's a bug. It should return 1. The problem is that Locate uses indexing, and it appears that later values are replacing the hashtable keys of earlier values. I'll get that corrected for the next release.

    I can't really say why you can't edit NewDataTxt.
  • OK, Thanks Kevin.
  • Fantastic, that was quick.

    Thank you.
  • That did the trick, thanks again. BTW using these two functionw have made significant speed improvements to my software.
  • Jim - If you are willing, either here or by private email, I would very much like to know what you were doing previously that these functions helped to improve performance with.
  • Extracting data from and inserting data into a multidimensional array in a loop, using <>. Subroutine also used locate. Subroutine was called repeatedly 1000's of times.
  • Kevin,
    I might be seeing a slowdown in this version. I was on 2.1.5, could I get a link to this version so I can compare?
  • How do I install this zip?
  • edited October 2020
    Just uninstall extract the files into an empty folder. From the Application Manager press F12 to bring up the System Monitor. Enter the following:
    RUN RDKINSTALL "< path to RDK files >"
Sign In or Register to comment.