Hi all,
I'm trying to update a record in my table based on 2 fields
I'm facing problem in selecting data based on Tag id and date value. It's not taking date value
Patch( '[GLOBUS_APP].[T5010E_TAG_REQ_FAM]', LookUp( '[GLOBUS_APP].[T5010E_TAG_REQ_FAM]', C5010_TAG_ID = Gallery1.Selected.TAG_ID && C5010E_ACTIVE_FL = 1 && C5010E_LAST_TRANS_ID = Gallery1.Selected.C526_PRODUCT_REQUEST_DETAIL_ID && C5010E_PLACEMENT_DATE = Text(Gallery1.Selected.PLACEMENT_DATE,"[$-en-US]dd/mmm/yyyy") ), {C5010E_ACTIVE_FL: 0} );
Solved! Go to Solution.
Hi @SumanKoduri ,
Is the "C5010E_PLACEMENT_DATE" column a Date Time type column in your SQL Table?
Based on the issue that you mentioned, I think this issue may be related to Time Zone. If you create a Date Time type column in your SQL Table, when retrieving the date time value within PowerApps, the date time value may be rendered as a different date time value (due to Time Zone issue).
Actually, it is an known issue with date time field in SQL Table -- when using datetime (and friends) in SQL with PowerApps, then you may have the offset issues.
Please check and see if the following blog would help in your scenario:
https://powerapps.microsoft.com/en-us/blog/working-with-datetime-values-in-sql/
Patch(
'[GLOBUS_APP].[T5010E_TAG_REQ_FAM]',
LookUp(
'[GLOBUS_APP].[T5010E_TAG_REQ_FAM]',
C5010_TAG_ID = Gallery1.Selected.TAG_ID &&
C5010E_ACTIVE_FL = 1 &&
C5010E_LAST_TRANS_ID = Gallery1.Selected.C526_PRODUCT_REQUEST_DETAIL_ID &&
DateValue(
Text(
DateAdd(C5010E_PLACEMENT_DATE, TimeZoneOffset(C5010E_PLACEMENT_DATE), Minutes), // Modify formula here
DateTimeFormat.ShortDate
)
) = DateValue(Text(Gallery1.Selected.PLACEMENT_DATE, DateTimeFormat.ShortDate))
),
{
C5010E_ACTIVE_FL: 0
}
);
Please take a try with above formula, then check if the issue is solved.
You could also consider change the data type of the "C5010E_PLACEMENT_DATE" column in your SQL Table from Date time to datetimeoffset type, then you would not suffer from the Time Zone issue within your canvas app.
Best regards,
Hi @SumanKoduri ,
You are trying to compare a Text value with a Date value.
There are other patterns available, but the one I use is
Patch(
'[GLOBUS_APP].[T5010E_TAG_REQ_FAM]',
LookUp(
'[GLOBUS_APP].[T5010E_TAG_REQ_FAM]',
C5010_TAG_ID = Gallery1.Selected.TAG_ID &&
C5010E_ACTIVE_FL = 1 &&
C5010E_LAST_TRANS_ID = Gallery1.Selected.C526_PRODUCT_REQUEST_DETAIL_ID &&
DateDiff(
C5010E_PLACEMENT_DATE,
Gallery1.Selected.PLACEMENT_DATE
)=0
),
{C5010E_ACTIVE_FL: 0}
)
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.
it still not updated in db and showing date field value as invalid
Blue lines are a Delegation error - nothing to do with validity of the code. Date filters are not delegable.
One workaround is to have a numeric field updated each time the date picker is changed set to
Value(
Text(
YourDateControlName.SelectedDate,
"[$-en-US]yyyymmdd"
)
)
then you can do a delegable search directly on this field
Value(Text(Gallery1.Selected.PLACEMENT_DATE,"[$-en-US]yyyymmdd")) = YourNumericFieldName
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.
Hi @SumanKoduri ,
Could you please share a bit more about the "C5010E_PLACEMENT_DATE" field in your Table? Is it a Date time type column?
I have made a test on my side, please consider modify your formula as below:
Patch(
'[GLOBUS_APP].[T5010E_TAG_REQ_FAM]',
LookUp(
'[GLOBUS_APP].[T5010E_TAG_REQ_FAM]',
C5010_TAG_ID = Gallery1.Selected.TAG_ID &&
C5010E_ACTIVE_FL = 1 &&
C5010E_LAST_TRANS_ID = Gallery1.Selected.C526_PRODUCT_REQUEST_DETAIL_ID &&
DateValue(Text(C5010E_PLACEMENT_DATE, DateTimeFormat.ShortDate)) = DateValue(Text(Gallery1.Selected.PLACEMENT_DATE, DateTimeFormat.ShortDate))
),
{
C5010E_ACTIVE_FL: 0
}
);
Please consider take a try with above formula within your app, check if the issue is solved.
Best regards,
It is a date field
Hi @SumanKoduri ,
Yeah, Have you taken a try with the solution I provided above?
Based on the needs that you mentioned, I think the solution provided above could achieve your needs. Please take a try with it, check if the issue is solved.
Best regards,
I tried but it still not updating active field to 0
Hi @SumanKoduri ,
Is the "C5010E_PLACEMENT_DATE" column a Date Time type column in your SQL Table?
Based on the issue that you mentioned, I think this issue may be related to Time Zone. If you create a Date Time type column in your SQL Table, when retrieving the date time value within PowerApps, the date time value may be rendered as a different date time value (due to Time Zone issue).
Actually, it is an known issue with date time field in SQL Table -- when using datetime (and friends) in SQL with PowerApps, then you may have the offset issues.
Please check and see if the following blog would help in your scenario:
https://powerapps.microsoft.com/en-us/blog/working-with-datetime-values-in-sql/
Patch(
'[GLOBUS_APP].[T5010E_TAG_REQ_FAM]',
LookUp(
'[GLOBUS_APP].[T5010E_TAG_REQ_FAM]',
C5010_TAG_ID = Gallery1.Selected.TAG_ID &&
C5010E_ACTIVE_FL = 1 &&
C5010E_LAST_TRANS_ID = Gallery1.Selected.C526_PRODUCT_REQUEST_DETAIL_ID &&
DateValue(
Text(
DateAdd(C5010E_PLACEMENT_DATE, TimeZoneOffset(C5010E_PLACEMENT_DATE), Minutes), // Modify formula here
DateTimeFormat.ShortDate
)
) = DateValue(Text(Gallery1.Selected.PLACEMENT_DATE, DateTimeFormat.ShortDate))
),
{
C5010E_ACTIVE_FL: 0
}
);
Please take a try with above formula, then check if the issue is solved.
You could also consider change the data type of the "C5010E_PLACEMENT_DATE" column in your SQL Table from Date time to datetimeoffset type, then you would not suffer from the Time Zone issue within your canvas app.
Best regards,
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
205 | |
70 | |
51 | |
49 | |
20 |
User | Count |
---|---|
262 | |
120 | |
85 | |
80 | |
68 |