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

SRP_Array sort wiping variable

Issue with 2.0.2.RC8

ITEM=SRP_Array("SortRows",ITEM,"AL1",0)

Variable content is being lost
Text file to use is attached


Comments

  • If you remove the '0' (Format param) does it work
  • No, still the same
    Now : ITEM=SRP_Array("SortRows",ITEM,"AL1")

    I copied the old format and omitted to remove the ,0
    But same issue.

  • in the old format, there is the same result, or did 2.0.2.RC8 fix that
  • ...just to be clear ITEM=SRP_Sort_Array(ITEM,"AL1",0)
  • The old format failed.
    I then changed to the new format to see if that was any different, still failed.
    Then removed the extra ",0" that should not have been there, still failed.

    I have had RC8 in for a few weeks resolving a similar issue with Rotate Array, so expect something similar exists with Sort Array
  • Thanks, Colin. I'll take a look this afternoon.
  • SRP Utilities 2.0.2 RC10 will fix this issue. As you suspected, it was a similar issue as SRP Rotate Array. I went through the rest of the array code to make sure all memory allocated is large enough. Hopefully, this is the last time we have a thread like this.
  • Kevin

    Installed the RDK, copied the DLL in, and reran.
    Same issue still there, although seeing a lot more @VMS
    Tried both formats of the command.
  • Seems strange that it is memory allocation, when the example data is only about 1k in size.
  • I have to pre-allocate enough space to fit the results. Since your data has one field that contains 1933 values, it causes the results to have 1933 values in all the fields, which increases the size of the results quite a bit. Your array is 3699 bytes at the start, but the result needs 22511 bytes to fit all those value marks.

    I reviewed the data, and while it looks bizarre due to the thousands of empty values, I think it's correct. I used Rotate Array to look at the data, and it's definitely sorting on column 1, but you don't see anything useful until row 1897. There are a handful of rows at position 38. Granted, those should probably be sorted much lower, but can you agree that no algorithm is going to sort so much empty data in a way that is terribly useful? We are using the same data, right?
  • SRP Utilities 2.0.2 RC11 will ensure all columns will sort using AL if not otherwise specified. Thus, you should now see all your non-blank rows aggregate at the bottom starting at row 1860.
  • Thanks, Work OK
    There was also a bug in my code, there was a field with more @vms than there should have been, which pushed all the data along, even though field 1, the sort field was limited. So when I looked in debug all I saw was @vms and did not scroll all the way to the right to see the data.


    I now do a TrimTrailing on each @fm before sorting, and all now good
    Thanks
Sign In or Register to comment.