cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Problem retrieving existing records.

I would like to use one screen/form to add and edit records for a one to one related table. But I have a problem retrieving existing records.

 

When Navigating I am switching between NewForm and EditForm based on a lookup to see if TheID exist in the related table...

If(IsBlank(LookUp('[dbo].[MyTable]', TheID = TheParentGalley.Selected.TheID,TheID))

,Navigate(scrMyTable,Fade, {NewRecord:true});NewForm(frmMyTable)

,Navigate(scrMyTable,Fade, {NewRecord:false});EditForm(frmMyTable)

)

 

Then in the DataSource of the form I have

If(NewRecord

,'[dbo].[MyTable]'

, Filter('[dbo].[MyTable]', TheID= TheParentGalley.Selected.TheID)

)

 

When debugging with a text box I can see the NewRecord , DisplayMode and TheParentGalley.Selected.TheID are all coming across like they should. But when I look at the text value of txtTheID in the card of the form, it is blank ... thus I do not believe I am pull the record back in 

 

Suggestion on what I am missing or doing wrong? Thanks for the help in advance

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: Problem retrieving existing records.

Hi @AccessPowerApps,

 

There is no need to add If condition for the Data Source property of the form control.

You could just specify the Data Source to '[dbo].[MyTable]'

 

The property that have the form control to show the proper record is the item property.

If there is only one record that have the theID value, then we could specify the item property of the form control as the formula below:

first(Filter('[dbo].[MyTable]', 
TheID= TheParentGalley.Selected.TheID)
)

For more information about form control, check:

Edit form and Display form controls in PowerApps

 

Regards,

Michael

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

View solution in original post

1 REPLY 1
Community Support
Community Support

Re: Problem retrieving existing records.

Hi @AccessPowerApps,

 

There is no need to add If condition for the Data Source property of the form control.

You could just specify the Data Source to '[dbo].[MyTable]'

 

The property that have the form control to show the proper record is the item property.

If there is only one record that have the theID value, then we could specify the item property of the form control as the formula below:

first(Filter('[dbo].[MyTable]', 
TheID= TheParentGalley.Selected.TheID)
)

For more information about form control, check:

Edit form and Display form controls in PowerApps

 

Regards,

Michael

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

View solution in original post

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,692)