Skip to main content

Notifications

Community site session details

Community site session details

Session Id : S5u5snyoDBBKKebAB0JVHE
Power Apps - Building Power Apps
Answered

Set DataCardValue equal to DataCard

Like (0) ShareShare
ReportReport
Posted on 27 May 2020 23:47:23 by 33

I have a form that saves a quote to a SharePoint List.  When I retrieve a saved quote to edit it, it saves all of the values in the ThisItem.X parameter which is stored in the Default field of the parent card.  I think that is pretty standard but, just to be sure, here is an example.

 

I have a card called crdDescription_1 and in that card is a single item combo box called cboDescription_1.  In the "Default" field of the card, it has ThisItem.Description_1.  What I'm trying to do is set cboDescription_1.Selected.ProductDescription to be equal to ThisItem.Description_1.

 

The main reason for this is because when the form is submitted, I'm doing a ClearCollect which is collecting cboDescription_1.Selected.ProductDescription (along with a lot of other stuff) and sending it to Flow.  This all works fine for a new quote because when an item is selected from the drop-down, it is stored in cboDescription_1.Selected.ProductDescription.

 

Maybe I'm going about this the wrong way?

Categories:
  • Tarterman Profile Picture
    33 on 02 Jun 2020 at 20:31:23
    Re: Set DataCardValue equal to DataCard

    Hi @v-xida-msft,

     

    Thank you very much for this.  It was exactly what I needed and got it working.

     

    Thanks,

    Tarterman

  • Verified answer
    v-xida-msft Profile Picture
    on 29 May 2020 at 01:28:54
    Re: Set DataCardValue equal to DataCard

    Hi @Tarterman ,

    I have received your reply in my mailbox, but it could not be displayed here, it seems that your reply has been marked as Spam.

     

    Based on your reply, I think my understanding is correct. Your cboDescription_1 ComboBox is pulling data from another data source (Excel table on your side).

     

    According to the needs that you mentioned, I think you want to get the stored Description_1 Choice field value from your SP list, then populate it within the cboDescription_1 ComboBox, is it right? Have you taken a try with the DefaultSelectedItems property of the cboDescription_1 ComboBox I mentioned above?

     

    Based on the needs that you mentioned, I think the DefaultSelectedItems property of the cboDescription_1 ComboBox could achieve your needs. If you store the ProductDescription column value from your Excel table into the Description_1 Choice field in your SP List, please take a try with the following workaround:

    Set the DefaultSelectedItems property of the cboDescription_1 ComboBox to following:

    LookUp('Your Excel Table', ProductDescription = ThisItem.Description_1.Value)

    Note: The 'Your Excel Table' represents your Excel table data source.

     

    Please try above solution, then check if the issue is solved. If you still could not reply here, please consider click "Accept as Solution" to identify this thread closed, and then re-open a new thread, describe your needs in the new opening thread, then I would help you in that new thread.

     

    Best regards,

  • Tarterman Profile Picture
    33 on 28 May 2020 at 23:37:56
    Re: Set DataCardValue equal to DataCard

    Hi @v-xida-msft,

     

    Thanks for the info.  I would very much agree with this statement:

     

    "I think you have some misunderstand on the update mechanism within the Edit form of canvas app."  🙂  I'm still learning this and editing forms is definitely confusing me.

     

    To answer your initial questions, the Description_1 field is a Choice type field in my SP list.  It is pulling its data from an Excel table.  So, in the Items field of the cboDescription_1 combo box, it just says Products which is the name of the Excel table.  The combo box itself is setup as a Double layout so that it shows the Product Description and then shows the Part Number below it.  To give a visual, here is what my screen looks like when blank:

     

    QuoteDetailsNew1.JPG

     

    The Base Product drop-down list in the upper, right-hand corner has the capability to control the first four combo boxes under the Description column.  For simplicity, I am just focusing on the first one since the other three are behaving the same way but for the same reason.  The DefaultSelectedItem field of the first combo box has a variable called varDescription_1.  The Base Product drop-down box sets that variable based on what is selected.

     

    I added some fields at the bottom for testing just so I could get a better understanding of what happens when I do certain things.  I put labels above the fields so you can see what formula it is looking at.  As the screenshot below shows, if I select an item from cboDescription_1, it populates to cboDescription_1.Selected.ProductDescription.

     

    QuoteDetailsEdit2.jpg

     

    This works how I would expect and is used in the formula for the Next button which does a ClearCollect on everything in the form.  Here is a sample for the code for just the first line:

     

     

    ClearCollect(
     colQuoteDetails,
     {
     Description: cboDescription_1.Selected.ProductDescription,
     PartNumber: cboDescription_1.Selected.ProductPartNumber,
     MSRP: txtMSRP_1.Text,
     Qty: txtQty_1.Text,
     PartnerDiscount: txtPartnerDiscount_1.Text,
     RegistrationDiscount: txtRegistrationDiscount_1.Text,
     UnitCost: txtUnitCost_1.Text,
     TotalCost: txtTotalCost_1.Text
     },
    etc...

     

     

    I send the collections to Flow and that all works fine for a new quote.  When I edit a quote, the values get stored in the Card as opposed to the combo box (if that makes sense).  Here is what the form looks like when I edit a quote:

     

    QuoteDetailsEdit1.JPG

     

    You can see that cboDescription_1.Selected.ProductDescription is blank but crdDescription_1.Default has the value.  The Update field of crdDescription is 

     

    {Value:cboDescription_1.Selected.ProductDescription}

     

     

    So, both the info I send to Flow and the Update function rely on the data being in cboDescription_1.Selected.ProductDescription and that's what I can't figure out.  Once I am editing a quote, I can't figure out how to get the value from crdDescription_1.Default to cboDescription_1.Selected.ProductDescription.

     

    Hopefully my explanation makes sense.  I'm still coming up to speed on some of the terminology.

  • v-xida-msft Profile Picture
    on 28 May 2020 at 08:52:56
    Re: Set DataCardValue equal to DataCard

    Hi @Tarterman ,

    Could you please share a bit more about the "Description_1" field? Is it a Choice type field in your SP List?

    Could you please show more details about the formula you typed within the Items property of the cboDescription_1?

    Do you reference values from other SP List as option list within the cboDescription_1?

     

    Based on the statement that you mentioned, I think you have some misunderstand on the update mechanism within the Edit form of canvas app.

    Actually, these entered values in a Edit form could be saved back to SP List properly is based on the Update property of the data cards in your Edit form rather than the Default property of the data card.

    Please check the following article for more details:

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/controls/control-form-detail#key-properties

     

    The Default property of data card is just used to reference the column value stored in your SP List itself through ThisItem.CoumnName formula.Then within the ComboBox (or other child control), you could reference the column value through Parent.Default formula, which has same effect as the ThisItem.CoumnName formula.

     

    If you reference values from other SP List as option list within the cboDescription_1, and you want to display the selected ProductDescription value based on the stored the Description_1 value, please take a try with the following workaround:

    Set the DefaultSelectedItems property of the cboDescription_1 to following:

    {
     ProductDescription: ThisItem.Description_1.Value
    }

    Note: The Description_1 column is a Choice type column in your SP List. The ProductDescription column represents the column from other SP List, which you used as Display column value within this cboDescription_1.

     

    Best regards,

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,079 Most Valuable Professional

Leaderboard
Loading started