Filter an array by content

J. Landman Gay jacque at hyperactivesw.com
Fri Jun 21 14:38:31 EDT 2019


Found the problem. My script local was being emptied for some reason, so 
there was nothing to filter. After repopulating all data it worked.

My only excuse is that I've been avoiding stepping through the debugger 
because LC has been crashing when I do that. I've sent in many crash 
logs but it's only recently I've discovered it happens only with Step 
Over. It's hard to believe no one else has seen this, which I've been 
seeing since LC 9 first came out, but that's why I didn't know what was 
in the variable. Now that I've discovered breakpoints don't crash as 
long as I don't step through, I was able to see what's going on.

If you have experienced crashes during debugging, take a look at 
https://quality.livecode.com/show_bug.cgi?id=22130 and 
https://quality.livecode.com/show_bug.cgi?id=21876

I have several more in my collection that I haven't uploaded yet.

On 6/21/19 4:26 AM, Niggemann, Bernd via use-livecode wrote:
> 
> Am 21.06.2019 um 09:01 schrieb use-livecode-request at lists.runrev.com<mailto:use-livecode-request at lists.runrev.com>:
> 
> From: "J. Landman Gay"
> 
> I spoke too soon. When I tested, I hard-coded a value as the filter
> string. But when I use a variable, it fails as it did before. The
> elements of the array all start with a 4-character string followed by an
> underscore, for example:  ER01_some text here
> 
> My variable contains "ER01":
> 
>    put tVar & "_*" into tFilter
>    filter elements of sArray with tFilter into tNewArray
> 
> No go. I've tried a few different iterations. However, this works:
> 
>    filter elements of sArray with "ER01_*" into tNewArray
> 
> 
> This works for me in 9.0.4 and 9.5 DP1
> 
> ----------------------------------------------------
> on mouseUp
>     local tErr = "ER01"
>     local tArray, tVar, tNewArray
> 
>     put (tErr & "_*") into tVar
> 
>     repeat with i = 1 to 17
>        if i mod 2 is 1 then
>           put tErr & "_" & i into tArray[i]
>        else
>           put i into tArray[i]
>        end if
>     end repeat
>     breakpoint
>     filter elements of tArray with tVar into tNewArray
>     breakpoint
>     filter elements of tArray with tVar
>     breakpoint
> end mouseUp
> ----------------------------------------------------
> 
> may be O <> zero?
> 
> Kind regards
> Bernd
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 


-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list