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 Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Top Solution Authors
Users online (5,494)