cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
sammybridge
Level: Powered On

UpdateIf With CDS LookUp Columns

Hello,

 

I am using CDS here. I am trying to do an UpdateIf and one of my conditions is to ask if the ID number is equal to a variable I am setting. I can't see to get this condition to work for some reason. This is my code. The bit in red is the bit that isn't working. The ID part at the start is the column name in the Entity 'NPI Tasks', however this references another Entity which has IDNew as its Primary Key. I have used this condition on loads of other places in my app and it works fine, however it isn't working in this circumstance.

 

UpdateIf(

'NPI Tasks',
Stage = Value(taskstage + 1) And Value(Label9.Text) = 0 And ID.IDNew = idvar,
{cr80a_duedate: Today() + 5}
)

 

Thanks

1 REPLY 1
Community Support Team
Community Support Team

Re: UpdateIf With CDS LookUp Columns

Hi @sammybridge ,

Could you please share a bit more about your scenario?

Is the "ID" column a LookUp type column in your 'NPI Tasks' Entity? Could you please show more details about the idvar variable that you mentioned?

Further, do you store the IDNew (Primary Key) value of an record in your 'Another Entity' into the idvar variable?

 

On your side, please make sure you have stored the IDNew (Primary Key) value (GUID value) of an record in your 'Another Entity' into the idvar variable. If the IDNew (Primary Key) value stored in this idvar variable is a string value, please consider modify your formula as below:

UpdateIf(
          'NPI Tasks',
          Stage = Value(taskstage + 1) && Value(Label9.Text) = 0 && ID.IDNew = GUID(idvar),
          {
            cr80a_duedate: Today() + 5
          }
)

Does the Label9 connect to a field in your 'NPI Tasks' Entity, if true, please replace the Label9.Text formula with actual field name from your 'NPI Tasks' Entity within above formula:

UpdateIf(
          'NPI Tasks',
          Stage = Value(taskstage + 1) && Value('Actual Field Name') = 0 && ID.IDNew = GUID(idvar),
          {
            cr80a_duedate: Today() + 5
          }
)

 

In addition, you could consider store the specific record from your 'Another Entity' into this idvar variable using the following formula:

Set(idvar, LookUp('Another Entity', FilteredColumn = "Specific Value"))

then modify your UpdateIf formula as below:

UpdateIf(
          'NPI Tasks',
          Stage = Value(taskstage + 1) && Value('Actual Field Name') = 0 && ID.IDNew = idvar.IDNew, // or type idvar.cr80a_IDNew
          {
            cr80a_duedate: Today() + 5
          }
)

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (5,305)