cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AccessPowerApps
Regular Visitor

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
v-micsh-msft
Community Support
Community Support

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
v-micsh-msft
Community Support
Community Support

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.

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (2,614)