cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Populating Default Value based off of Last(First) Expression

I'm trying to come up with the proper way to populate a default value in the 'Starting_Hobbs' based on the value in the 'Aircraft' field on the edit form.  I'm pulling from a SharePoint list and I want to pull the 'Ending_Hobbs" value that was last associated with the selected 'Aircraft' and populate that value into the 'Starting_hobbs' data card. This would only need to be useable when creating a new row.  

 

cfransen_0-1605512042591.png

cfransen_1-1605512069629.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Anonymous ,

Try this - on the OnChange of your Aircraft drop-down

UpdateContext(
   {
      vHobb:
      Last(
         Filter(
            'Aircraft Times',
            Aircraft=Self.Selected.Aircraft
         )
      )
   }
);
Reset(YourEndingHobbsTextControl)

 

 

then on the Default of your Ending_Hobb Text box

 

 

If(
   !IsBlank(vHobb),
   vHobb.Ending_Hobbs,
   Parent.Default
)

Then after the code you use to save (after SubmitForm)

UpdateContext({vHobb:Blank()})

It would be useful to also put this on Screen OnVisible 

 

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.

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @Anonymous ,

Try this - on the OnChange of your Aircraft drop-down

UpdateContext(
   {
      vHobb:
      Last(
         Filter(
            'Aircraft Times',
            Aircraft=Self.Selected.Aircraft
         )
      )
   }
);
Reset(YourEndingHobbsTextControl)

 

 

then on the Default of your Ending_Hobb Text box

 

 

If(
   !IsBlank(vHobb),
   vHobb.Ending_Hobbs,
   Parent.Default
)

Then after the code you use to save (after SubmitForm)

UpdateContext({vHobb:Blank()})

It would be useful to also put this on Screen OnVisible 

 

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.

Anonymous
Not applicable

Thanks @WarrenBelz ,

 

I can't seem to make that work on my end.  I'm sure I have some variable misnamed or something. 

 

Hi @Anonymous ,

I think I picked up the issue - I have amended to post - try it now. It works as below

ResetLastFilter.gif

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.

Anonymous
Not applicable

Thanks @WarrenBelz but I can't seem to get it to work.  It's beyond my skillset, I'll hire out to make it work. Thanks

 

Anonymous
Not applicable

@WarrenBelz I was able to figure out the issue.  My Aircraft column is a complex column in Sharepoint and was causing the issue.  Thanks so much for the help. 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,813)