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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Set the default of a d...
Power Apps
Unanswered

Set the default of a datacard with the value of another datacard

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

(Edited)

Hello,

 

I am customizing a sharepoint list and one of the columns in there utilizes a another list(lookup).

Based on a selection, a user can indicare whether an employee exists in the lookup list or they want to enter a new employee.

If the employee does not exist and they want to enter a new employee, this is okay.

 

However, if the employee exists and they chose say John from the list, there are fields I have provided for users to enter a new employee infomation such as empId and empAge. These field will hide since the user already exists and the information(empId and empAge) is already in the lookup list.

 

What I want to happen is, when the user submits the form and selects an existing user in the lookup column, the fields I have provided for users to enter new employee information like empId and empAge, be filled with the infomation from the lookup column.

 

Eg.

 

New Form looks like this 

Emp Exists(DataCardValue1) - Yes 

Emp - John

EmpId - (This will be blank and hidden since DataCardValue1 is 'Yes')

EmpAge - (This will be blank and hidden since DataCardValue1 is 'Yes')

Submit

 

Lookup List

Employee    EmpId    EmpAge

John            231         43

Sam             123        32

 

This is what I want to get on the edit and view form

 

Emp Exists(DataCardValue1) - Yes 

Emp - John

EmpId - 231

EmpAge - 43

 

I have datacards that contain the references from the lookup list.

 

Form looks like this 

Emp:EmpAge(DataCardValue4_1)

Emp:EmpID(DataCardValue5_1)

 

What I want to do is to fill in the blank spaces the user didn't fill with the information i have from the list after they submit the form

I can use flow to semi do this but I was hoping for a powerapps solution

 

I have tried if(isblank(datacardvalue2), datacardvalue41.selected, Parent.default), obviously this isn't working...

Any solutions or ideas on how to go about this?

Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @Anonymous 

     

    Can you share more details about the controls and the associated attributes with it? The description provided is a bit confusing. 
     
    Suppose, combobox to select Employee,EmpId,EmpAge are named as DataCardValue12,DataCardValue13,DataCardValue14 respectively.
     
    Then defaultSelectedItems property of DataCardValue13 and DataCardValue14 should be modified to:
     
    DataCardValue13 : If(Form1.Mode = New, Lookup(ListName, Employee = DataCardValue12).EmpId,Parent.Default)
    DataCardValue14 : If(Form1.Mode = New, Lookup(ListName, Employee = DataCardValue12).EmpAge,Parent.Default)
     
    This will set the values based on the Employee selected on a New form.
     
    Hope this Helps!

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous ,

    Could you please share a bit more about your scenario?

    Do you want to fill in the blank spaces the user didn't fill with the information i have from the list after they submit the form?

     

    If you want to fill in the blank spaces the user didn't fill with the information i have from the list after they submit the form, I think the OnSuccess property of the Edit form and Patch function could achieve your needs.

     

    I have made a test on my side, please take a try with the following workaround:

    Set the OnSuccess property of the Edit form (where the user fill in Employee info) to following:

    Patch(
     'Main SP List',
     EditForm1.LastSubmit,
     {
     EmpId: If(IsBlank(EditForm1.LastSubmit.EmpId), LookUp('LookUP List', Employee = EditForm1.LastSubmit.Employee, EmpId)),
     EmpAge: If(IsBlank(EditForm1.LastSubmit.EmpAge), LookUp('LookUP List', Employee = EditForm1.LastSubmit.Employee, EmpAge)),
    ... } );
    Back()

    Note: The EmpId, EmpAge and Employee represents the columns in your 'Main SP List', which your Edit form connects to.

     

    After the user submits the Edit form successfully, above Patch formula would be executed, then fill in the Blank value fields with info from the 'LookUp List'.

     

    Please take a try with above solution, then check if the issue is solved.

     

    Best regards,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @yashag2255 Thanks for the reply. I have edited my original post to make it more clearer.

     

    Your solution is almost what I want just missing a bit. I am sure this is because I didn't provide enough information.

     

    Even though I want to fill in the information from the lookup list, I only want to do that if the field is blank

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 305 Most Valuable Professional

#2
11manish Profile Picture

11manish 212

#3
Valantis Profile Picture

Valantis 167

Last 30 days Overall leaderboard