Perform a specific field search between two dates

Hi all,

I'm trying to resolve an issue with my sample search function. When performing a search between two dates without specifying a field, it works perfectly. However, when I include a specific field such as "status: working," the QuickFind returns results for both "working" and "not working." Interestingly, searching for "not working" works perfectly. I'm unsure where the issue lies in the script and need assistance in identifying the problem.


image

Not sure what the problem is. Working appears in both working and not working.

Could you provide a sample file with sample data to us? Is it related to the date you specify?

@Saeed
Try "==$Status" instead of only $Status.

Only searching for "working" finds any record where "working" is in the field. And that’s the case with "working" and "not working".

"==" compares the whole field content.

3 Likes

That was my guess ! The "==" is something not everybody knows or uses. and it is so useful.

4 Likes

Agreed with the explanation and suggestion that @mipiano posted.

Additionally:

It looks as though possibly find criteria are being set both at line 25 and line 27. The way that it has been set up is probably not causing any unexpected results, but, if the Find Records step at line 27 has been configured as shown in the screen capture, then I believe that would make line 25 unnecessary.

Some devs prefer the Find approach of entering Find mode and then using Set Field script steps (like line 24). Other devs prefer the approach of defining the Find criteria within the Perform Find [Restore] script step (line 27). I'm not thinking to try to steer you to one approach or the other, but I do wish to point out that the current combination of using both could cause some confusion to anyone maintaining the script at some time in the future.

Hope this helps.

5 Likes

I tired many time but same issue ..

@steve_ssh & @mipiano

After deleting line 25, the script works perfectly.

Re: "After deleting line 25, the script works perfectly."
You are deleting the wrong line. It is far easier to debug a Find if the criterion is set specifically, as in line 25. What you should do is remove the [Restore] option in line 27.
going back to the original question, another option you could try is search for "not", and perhaps omit to return the records that do not contain that word.

1 Like

Slight tweak to that. Rather than "==$Status", you are going to want:

"==" & $Status

Have the variable inside the quotes will search for that literal text with the dollar sign. You need to have it outside of the quoted double equals, then concatenate it with the ampersand.

6 Likes

Ooh! Great catch @flybynight .

FWIW: I think Shawn's (@flybynight ) answer is probably the one that should be marked as the correct solution.