cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
AccessPowerApps
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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

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