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

SRP_FastArray Match and Null Data

Is there a way to use SRP_FastArray Match to find null data in an array?

I have an array with two columns of data. I'd like to reduce the Array to only values that are not null in Array<2>. Using SRP_FastArray Match in a loop works great for all data except null. Any suggestion on how to accomplish this without having to resort back to slow angle bracket code?

Comments

  • The problem lies in the dual meaning of "". Sometimes it's a value, sometimes it's nothing. Take this for example:

    List = "Apple":@FM:"Banana":@FM:"":@FM:"Carrot"

    Item 3 in this list could mean (a) a FIELD whose content is "", or (b) a FIELD with no VALUES in it. SRP FastArray uses the second interpretation. I could alter this interpretation, but then I'd break code that relies on it's current implementation.

    There is, however, a work around that won't compromise on speed, but it has limitations. Since you didn't provide code, I don't know the complexity of the data you are searching, but one option is to use SRP List. SRP Lists are one-dimensional, so they will match against "" if you specify the MatchAll flag. You can quickly get from SRP FastArray to SRP List using the SRP_List CreateFromFastArray service.

    Here's some test code I wrote. I create a fast array, then I convert it to a List, then I Match against it.

    Test Match_Null // Create a fast array HandleFastArray = SRP_FastArray("Create", "Apple":@FM:"Banana":@FM:"":@FM:"Carrot") HandleList = SRP_List("CreateFromFastArray", HandleFastArray) FieldPos = 0 ValuePos = 0 SubValuePos = 0 // Find banana (MatchAll is the default) Count = SRP_List("Count", HandleList) Assert Count equals 4 Index = SRP_List("Match", HandleList, "", 1, "MatchAll") Assert Index equals 3 SRP_FastArray("Release", HandleFastArray) SRP_List("Release", HandleList) end test
  • Thanks Kevin - I didn't realize that the SRP_List "Match" worked differently than SRP_FastArray "Match". This should help me get the results I am looking for.
Sign In or Register to comment.