cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
M147954
Frequent Visitor

Update a drop down list when a date is entered

Hi,

 

I am building my first PowerApp using a SharePoint site and the user would like the "Stage" of the application (Stage_DataCard1, DataCardValue3) to automatically update when other 'triggers' such as "Transferred to Field Date" (DataCardValue17), "Test Completed by" (DataCardValue19) are completed. These fields will be blank (empty) before the data is entered (Date or text).

 

"DataCardValue3"  is a drop down list with items -  Choices([@'Log Requests'].Request_x0020_stage)

 

I need the DataCardValue3 to be either the selected value from the drop down list OR update automatically when one of the trigger points is reached. If a trigger is not met the stage should stay as the last stage.

 

Is this possible? if so how do I code it? I have had a look online and I think it should be possible but I can't see how - do I use UpdateContext, a plain If statement? Where do I put the code - in DataCardValue3 or where the trigger is entered (DataCardValue17 and DataCardValue19) and under which option?

 

Many thanks

A

 

31 REPLIES 31

Hi,

I am really sorry to re-open this query, but the user has come back with additional requirements, in addition to looking for blank fields - which I now have the coding for (thank you) - they want the Stage updated where an Or statement is needed and also where the fields will not be empty before the data is entered.

The Data cards in question are DataCardValue7 (Choice) and DataCardValue23 (date and time). The choices for DataCardValue7 are 'Select an option', 'CD', ' IRA' and 'EIR'. DataCardValue23 is blank until the date is entered. DataCardValue7 will be completed before DataCardValue23 so the ticket may never reach DataCardValue23 . Should 'Select an Option' or 'CD' be entered or the date entered in to DataCardValue23 the Stage should be changed to 'Complete'.

I have tried to amend your coding to accommodate the new requirements but have been unsuccessful with whatever I try.

What I have done is add the following after 'Value = "Transferred"), ' and before the final ' Parent.Default)) '

Not((DataCardValue7.Selected.Value = "CD"), Lookup(Choices(AB12.Stage), Value = "Completed"),

((DataCardValue7.Selected.Value = "Select an option"), Lookup(Choices(AB12.Stage), Value = "Completed"),

 

I have tried making this an 'If / Or' statement but nothing is successful - I just get warning messages and the code is underlined in red.

I haven't tried adding DataCardValue23 into the formula yet - I think it sensible to work out how to do DataCardValue7 first.

 

Can anyone help me with this please? 

BTW I am happy to open a new query if necessary.

 

Many thanks

 

A

 

 

 

Hi @AB12,

If I understand your new need here: DataCardValue7 and DataCardValue23 are two new conditions for setting the staging field to Completed:

  • if DataCardValue7 is Select an option or CD, then the staging field should be set to Completed
  • if DataCardValue23 date is entered, then the staging field should also be set to Completed

Is that it ?

Hi,

 

Yes that is correct. I thought it would be a straightforward "if(or" statement but - well obviously - I can't work out how to do it.

 

BTW I am now working on what will hopefully be the production site so I will take your advice on board and label the data card values appropriately before I start the coding.

 

Many thanks

Ok, so the formula should now be:

If(
    SharePointForm1.Mode = FormMode.New,
    LookUp(
        Choices(AB12.Stage),
        Value = "New"
    ),
    SharePointForm1.Mode = FormMode.View,
    Parent.Default,
    SharePointForm1.Mode = FormMode.Edit,
    If(
        Not(IsBlank(DataCardValueTestCompletedBy.Text)),
        LookUp(
            Choices(AB12.Stage),
            Value = "Tested"
        ),
        Not(IsBlank(DataCardValueTransferredToFieldDate.SelectedDate)),
        LookUp(
            Choices(AB12.Stage),
            Value = "Transferred"
        ),
        DataCardValue7.Selected.Value = "Select an option" || DataCardValue7.Selected.Value = "CD" || Not(IsBlank(DataCardValue23.SelectedDate)),
        LookUp(
            Choices(AB12.Stage),
            Value = "Completed"
        ),
        Parent.Default
    )
)

I haven't tested it though...

"...I will take your advice on board and label the data card values appropriately...👍👌👏

Hi,

Thank you for your coding suggestion but I'm afraid that I get error messages - The "function 'If' has some invalid arguments", "Invocation of unknown or unsupported arguments" and "The function 'IsBlank' has some invalid arguments".

 

Any thoughts?

Thanks

A

Can you tell me on which IsBlank there is the error ? Or post here a capture of the whole formula...

Hi,

It is the ||Not(IsBlank(DataCardValue23.SelectedDate)) which is causing the error - when I blank it out that section of the coding I get no error warnings however the value does not update to "Complete"  when it should. I have attached a screen grabs of both sets of coding (with and without blocked out coding).

 

Thanks

 

I'm sure you can find the error yourself if you look closely at what you wrote in your formula... 😏

- opps - I can't type (or code!) - I have been looking at the screen for so long I missed it 😥

 

 - thanks

No problem... 😉

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

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

Top Solution Authors
Users online (1,310)