web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Issue with default val...
Power Apps
Suggested Answer

Issue with default value of data card in form for 1:N relationship SharePoint lists

(1) ShareShare
ReportReport
Posted on by 8
HIi,
 
I'm building an app which should allow users to insert risks for projects. On the main screen there is a project gallery in which users can select a project and then navigate to the next screen in which I have a gallery for the visulaization of the risks and a form to edit existing or create new risks. The risks screen will always show only the risks associated to the one specific project which has been selected on the main screen.
 
Data source for the project gallery on the main screen is a SharePoint lists called "Projects", data source for the gallery and form on the risks screen is a SharePoint list called "Project risks". The "Project risks" list contains a lookup column "Project" which for the 1:N relationship between the 2 lists.
 
In the Form on the risks screen there is a field for the project column of the "Project risks" list. It "Default" value is set to "ThisItem.Project", the Item property of the Form is set to  "RisksGallery.Selected"
 
I want to achieve the same behaviour as in the following video https://www.youtube.com/watch?v=SCYY9ZL48Mw at 6:45 min. When a new risks should be created, the project field of the form should be filled with the project reference of the project
selected in the gallery on the main screen.
 
I tried changing the "Default" value of the project fieled in the form to 
Switch(
    RisksForm.Mode,
    FormMode.Edit,
    ThisItem.Project,
    FormMode.New,
    ProjectGallery.Selected.'Active Projects'
)
 
The "Active Projects" column contains the project reference. The issue is, that ProjectGallery.Selected.'Active Projects' is not recognized. 
 
If I'm using only "ProjectGallery.Selected", the selection shows up, but I cannot select the "Active Projects" value
 
 
I also tried to setting a variable when selecting a project in the projects gallery as Reza Dorrani did in this video.
Again this is not working when referencing a specific value of the selection.
 
When only referencing the variable itself which contains the selection, the selection is shown.
 
 
I don't get what iI'm doing wrong. 
 
 
Thanks in advance.
 
 
Best regards
 
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,084 Most Valuable Professional on at
    What type of field is 'Active Projects'  and what is the Items of the Gallery Also where exactly are you using that code ?
  • Suggested answer
    Michael E. Gernaey Profile Picture
    53,442 Super User 2025 Season 2 on at
    Hi,
     
    In addition to what Warren is saying, you are not supposed to try to access components on another screen. I understand that the Project Gallery is on a 
    totally different screen correct?
     
    Personally I would have passed the Project Record as a Context Variable between screens
     
    Navigate(myscreen2, Transition.None/Right/whateverYouwant, { _ProjectRecord: ProjectGallery.Selected });
     
    As for why its not working is because (I am guessing) if its a LookUp
     
    its really 'Active Projects'.'Active Project' for the GUID reference but since its from another Screen its not going to work and is not intended to work even if a Bug in the platform made it work.
     
    that being said, you could also simply do
     
    In the Context Variable Pase the ProjectGallery.Selected.'Project Id' or whatever the proper name is
    Navigate(myscreen2, Transition.None/Right/whateverYouwant, { _ProjectId: ProjectGallery.Selected.'Project Id' });
     
    Then in your Form
     
    LookUp(Projects, ID = _ProjectID)
     
     
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard