# Perform a specific field search between two dates

**URL:** https://the.fmsoup.org/t/perform-a-specific-field-search-between-two-dates/4162
**Category:** Questions
**Created:** [June 25, 2024, 3:32pm UTC](https://the.fmsoup.org/t/perform-a-specific-field-search-between-two-dates/4162 "2024-06-25T15:32:32Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Saeed](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@Saeed](https://the.fmsoup.org/u/Saeed)
#### Post date: [June 25, 2024, 3:32pm UTC](https://the.fmsoup.org/t/perform-a-specific-field-search-between-two-dates/4162/1 "2024-06-25T15:32:32Z")

</div>

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](https://canada1.discourse-cdn.com/flex030/uploads/fmsoup/original/2X/f/f6feb48738dc267a59412ade3d332d180ceb127f.png)  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/fmsoup/original/2X/1/13425271a29adbfa8e27f14d68e929884dd7c5be.png)

---

<div class="post-metadata">

### Author: ![bdbd](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/bdbd/32/620_2.png) [@bdbd](https://the.fmsoup.org/u/bdbd)
#### Post date: [June 25, 2024, 5:17pm UTC](https://the.fmsoup.org/t/perform-a-specific-field-search-between-two-dates/4162/2 "2024-06-25T17:17:13Z")

</div>

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

---

<div class="post-metadata">

### Author: ![samfmp](https://avatars.discourse-cdn.com/v4/letter/s/a9a28c/32.png) [@samfmp](https://the.fmsoup.org/u/samfmp)
#### Post date: [June 25, 2024, 8:34pm UTC](https://the.fmsoup.org/t/perform-a-specific-field-search-between-two-dates/4162/3 "2024-06-25T20:34:52Z")

</div>

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

---

<div class="post-metadata">

### Author: ![mipiano](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/mipiano/32/1074_2.png) [@mipiano](https://the.fmsoup.org/u/mipiano)
#### Post date: [June 25, 2024, 9:25pm UTC](https://the.fmsoup.org/t/perform-a-specific-field-search-between-two-dates/4162/4 "2024-06-25T21:25:00Z")

</div>

@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.

---

<div class="post-metadata">

### Author: ![planteg](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/planteg/32/627_2.png) [@planteg](https://the.fmsoup.org/u/planteg)
#### Post date: [June 25, 2024, 10:07pm UTC](https://the.fmsoup.org/t/perform-a-specific-field-search-between-two-dates/4162/5 "2024-06-25T22:07:09Z")

</div>

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

---

<div class="post-metadata">

### Author: ![steve\_ssh](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/steve_ssh/32/160_2.png) [@steve\_ssh](https://the.fmsoup.org/u/steve_ssh)
#### Post date: [June 26, 2024, 1:39am UTC](https://the.fmsoup.org/t/perform-a-specific-field-search-between-two-dates/4162/6 "2024-06-26T01:39:36Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Saeed](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@Saeed](https://the.fmsoup.org/u/Saeed)
#### Post date: [June 26, 2024, 3:06am UTC](https://the.fmsoup.org/t/perform-a-specific-field-search-between-two-dates/4162/8 "2024-06-26T03:06:38Z")

</div>

I tired many time but same issue ..

---

<div class="post-metadata">

### Author: ![Saeed](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@Saeed](https://the.fmsoup.org/u/Saeed)
#### Post date: [June 26, 2024, 3:13am UTC](https://the.fmsoup.org/t/perform-a-specific-field-search-between-two-dates/4162/9 "2024-06-26T03:13:20Z")

</div>

@steve_ssh & @mipiano

After deleting line 25, the script works perfectly.

---

<div class="post-metadata">

### Author: ![Keywords](https://avatars.discourse-cdn.com/v4/letter/k/7bcc69/32.png) [@Keywords](https://the.fmsoup.org/u/Keywords)
#### Post date: [June 26, 2024, 11:29am UTC](https://the.fmsoup.org/t/perform-a-specific-field-search-between-two-dates/4162/10 "2024-06-26T11:29:57Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![flybynight](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/flybynight/32/1023_2.png) [@flybynight](https://the.fmsoup.org/u/flybynight)
#### Post date: [June 27, 2024, 6:14am UTC](https://the.fmsoup.org/t/perform-a-specific-field-search-between-two-dates/4162/11 "2024-06-27T06:14:44Z")

</div>

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

```auto
"==" & $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.

---

<div class="post-metadata">

### Author: ![steve\_ssh](https://yyz2.discourse-cdn.com/flex030/user_avatar/the.fmsoup.org/steve_ssh/32/160_2.png) [@steve\_ssh](https://the.fmsoup.org/u/steve_ssh)
#### Post date: [June 27, 2024, 6:48pm UTC](https://the.fmsoup.org/t/perform-a-specific-field-search-between-two-dates/4162/12 "2024-06-27T18:48:02Z")

</div>

Ooh! Great catch @flybynight .

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