Days wasted on what should be a simple problem to solve...
I have a parent SP list and a child list. The child needs the ID from the parent.
In PA, I have two screens. Screen 1 allows a user to populate and create an item in the parent SP list.
When navigating to the child screen to create a related item, how does one set the ID of the child item whcn the screen is dsiplayed.
Solved! Go to Solution.
Already did this.
Appreciate you suggestion.
JasonF
Do you mean how do you know what the ID of the parent item is when you are on the child screen? If that's what you are asking then use UpdateContext to set a variable equal to the ID of the parent item when you navigate to the child screen.
No, not quite. I know the ID of the parent. I have that stored in a variable. I'm trying to set the parent ID on the child screen.
Do you have a particular field where the Parent ID is kept in a child record? Is there a lookup field in the child record that connects to a specific parent record? If you don't have a Lookup field defined in the child list then you need to create one. If you do then review this article for information about how to set the Lookup field in PowerApps.
https://powerapps.microsoft.com/en-us/blog/support-for-lookups/
There IS a lookup field on the child. It is bound to the ID column on the parent list. The field renders correctly on the CHILD form and allows me to select one of the ID's available from the PARENT list. I can pick any ID and, when the CHILD form is submitted, the correct ID is saved within the CHILD record. I can therefore successfully create a PARENT / CHILD relationship.
The seemingly impossible task is to have the parent ID set automatically when the CHILD form is opened. I do not want people to have to pick the PARENT ID to which a child relates.
Set the default value of the field where you pick the parent ID on the child list to the variable where you save the parent ID. When you navigate to the child form that should default the ID to the correct value.
I agree with you, it shoudl indeed be that simple but, after numerous attempts of tyring to do it that way as well as things like {Id: varPArentID.ID} not a single way works. Even if I set the Default value to a static number, it does NOT set the ID.
I think I am having the same problem. Or maybe I should do a separate post on this.
Below is the CDS data structure:
I want to create the following data entry form:
Filling in the DIvision Name is not a problem, but during edit I have to generate the "Report No." (Does not gererate until post) for Daily Reports, Then use that entry in each Revenue entry. I am not thinking this should be so difficult.
Regards,
JasonF
OK, I've played around with it a little and this is what I've gotten to work.
For the DataValueField in the Data card for the parent List on the new child form set the defaultSelectedItems property to the following:
Choices([@Child].ParentList,Text(ParentID))
Where Child is the name of the child list datasource and ParentID is the name of the context variable that contains the ID of the item in the parent list.
Evidently since its a datacard you have to actually reference the "Choices" enumeration of the Lookup column that is instantiated in the card.
I think this provided part of my solution for the Revenue detail. However, I still need some way to post the Daily Report to generate the "Report No". Once I have this I can use Default() to fill the Revenus Detail. If I "SubmitForm" after Division Name is selected the I loose the data in the form.
User | Count |
---|---|
124 | |
87 | |
86 | |
75 | |
69 |
User | Count |
---|---|
214 | |
181 | |
140 | |
96 | |
83 |