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 News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,202)