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
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (2,061)