cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sshiny
Frequent Visitor

Date filter issue

I am trying to bring in a validation if the tag ID is entered more than once on the same daY and this is my code. The value is always false. Please suggest a workaround.

 

 

UpdateContext(

{
tagexists: If(
LookUp(
'[GLOBUS_APP].[T5007_RETURNS_LOG_DETAIL]',
C5010_TAG_ID = txtTagNumber.Text && Text(DateAdd(C5007_PROCESSED_DATE,TimeZoneOffset(),Minutes),"[$-en-US]mm/dd/yyyy") = Text(DateAdd(Today(),TimeZoneOffset(),Minutes),"[$-en-US]mm/dd/yyyy") ,
true
),
true,
false
)
}
);

7 REPLIES 7
WarrenBelz
Super User
Super User

Hi @sshiny ,

Firstly, you do not need the If/true/false when setting a Boolean Variable and I have also not considered your data logic as I am not clear on the Text/TimeZoneOffset, however you need to test if the lookup returns any records

UpdateContext(
   {
      tagexists: 
      !IsBlank(         
         LookUp(
            '[GLOBUS_APP].[T5007_RETURNS_LOG_DETAIL]',
            C5010_TAG_ID = txtTagNumber.Text && 
            Text(DateAdd(C5007_PROCESSED_DATE,TimeZoneOffset(),Minutes),"[$-en-US]mm/dd/yyyy") = 
            Text(DateAdd(Today(),TimeZoneOffset(),Minutes),"[$-en-US]mm/dd/yyyy"
         )
      )
   }
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

sshiny
Frequent Visitor

@WarrenBelz Eventhough there is a tag number in todays date it is returning false

 

@sshiny ,
As I noted, I had not considered your logic as I was unsure what you were doing with the text conversion in the dates and timezone offset - I would normally approach it something like this

UpdateContext(
   {
      tagexists: 
      !IsBlank(         
         LookUp(
            '[GLOBUS_APP].[T5007_RETURNS_LOG_DETAIL]',
            C5010_TAG_ID = txtTagNumber.Text && 
            IsToday(C5007_PROCESSED_DATE)
         )
      )
   }
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

WarrenBelz
Super User
Super User

Hi @sshiny ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

sshiny
Frequent Visitor

@WarrenBelz Not yet, it is still returning false.

 

@sshiny ,'

You could try this with a field value

UpdateContext(
   {
      tagexists: 
      !IsBlank(         
         LookUp(
            '[GLOBUS_APP].[T5007_RETURNS_LOG_DETAIL]',
            C5010_TAG_ID = txtTagNumber.Text && 
            IsToday(C5007_PROCESSED_DATE)
         ).C5007_PROCESSED_DATE
      )
   }
)

but the syntax will return true if you have a record in '[GLOBUS_APP].[T5007_RETURNS_LOG_DETAIL]' where C5010_TAG_ID equals the Text Box txtTagNumber AND C5007_PROCESSED_DATE is the current date. Please check your data to see if this is the issue.

 

WarrenBelz
Super User
Super User

Hi @sshiny ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (3,861)