cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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.

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (53,969)