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 Apps
Unanswered

dropdown

(0) ShareShare
ReportReport
Posted on by 25

Patch( tblOrders, Defaults(tblOrders), { QuoteNumber: v_PurchaseProduct.QuoteNumber, Revision: Max(Filter(tblOrders, QuoteNumber = v_PurchaseProduct.QuoteNumber), Revision) + 1 } );

Set(v_PurchaseProduct, { QuoteNumber: v_PurchaseProduct.QuoteNumber, Revision: Max(Filter(tblOrders, QuoteNumber = v_PurchaseProduct.QuoteNumber), Revision) } );

ForAll( Filter(tblPurchasedProducts_3, PO_ID = v_PurchaseProduct.QuoteNumber & "" & txtRevision.Text), Patch( 'Table Purchased Products', Defaults('Table Purchased Products'), { Product: ThisRecord.Product, PN: ThisRecord.PN, Quantity: ThisRecord.Quantity, PO_ID: v_PurchaseProduct.QuoteNumber & "" & Max(Filter(tblOrders, QuoteNumber = v_PurchaseProduct.QuoteNumber), Revision) } ) );

Refresh(tblOrders); Refresh(tblPurchasedProducts_3);

ClearCollect( GalleryData, Filter(tblOrders, QuoteNumber = v_PurchaseProduct.QuoteNumber) );

In this there is new revision button so when a user click on new revision the revision of that product is incremented and it shows in dropdown , also there is one textinput which has default value of that dropdown ,now what i want is whenever newrevision button is clicked the dropdown should have its default of that latest revision which value we get after incremented ,for example a product has 0 revision so when button is clicked revision is 1 so dropdown should have default value 1 and input text also

Categories:
I have the same question (0)
  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    hi @kritika26 ,

    To achieve the desired functionality where clicking the "New Revision" button updates both the dropdown and the text input to reflect the latest revision, you need to ensure that the dropdown and text input are set correctly after the new revision is created. Here is an approach to achieve this:

    1. Update the dropdown default: Set the default value of the dropdown to the latest revision.
    2. Update the text input default: Ensure the text input reflects the latest revision.

     

    // Increment the revision in tblOrders
    Patch(tblOrders, Defaults(tblOrders), {
     QuoteNumber: v_PurchaseProduct.QuoteNumber,
     Revision: Max(Filter(tblOrders, QuoteNumber = v_PurchaseProduct.QuoteNumber), Revision) + 1
    });
    
    // Update the v_PurchaseProduct variable with the new revision
    Set(v_PurchaseProduct, {
     QuoteNumber: v_PurchaseProduct.QuoteNumber,
     Revision: Max(Filter(tblOrders, QuoteNumber = v_PurchaseProduct.QuoteNumber), Revision) + 1
    });
    
    // Patch new revision details into 'Table Purchased Products'
    ForAll(
     Filter(tblPurchasedProducts_3, PO_ID = v_PurchaseProduct.QuoteNumber & "" & txtRevision.Text),
     Patch('Table Purchased Products', Defaults('Table Purchased Products'), {
     Product: ThisRecord.Product,
     PN: ThisRecord.PN,
     Quantity: ThisRecord.Quantity,
     PO_ID: v_PurchaseProduct.QuoteNumber & "" & Max(Filter(tblOrders, QuoteNumber = v_PurchaseProduct.QuoteNumber), Revision)
     })
    );
    
    // Refresh the data sources to reflect changes
    Refresh(tblOrders);
    Refresh(tblPurchasedProducts_3);
    
    // Clear and collect the latest data for the gallery
    ClearCollect(GalleryData, Filter(tblOrders, QuoteNumber = v_PurchaseProduct.QuoteNumber));
    
    // Set the default values for the dropdown and text input
    Set(varLatestRevision, Max(Filter(tblOrders, QuoteNumber = v_PurchaseProduct.QuoteNumber), Revision));
    
    // Assuming you have a dropdown control named DropdownRevision and a text input control named txtRevision
    DropdownRevision.Default = varLatestRevision;
    txtRevision.Default = varLatestRevision;
    ​

     

  • kritika26 Profile Picture
    25 on at

    But when we go back to gallery ,suppose we have 0 revision for that record so it should show default as zero in dropdown ,but what happens with me after incrementing if we go back to gallery if we click on record of zero revision it still show the maximum latest revision instead of revision of that record

  • anandm08 Profile Picture
    1,936 Super User 2024 Season 2 on at

    Update the dropdown and text input when a specific record is selected: Set the default values based on the selected record from the gallery.

    // Assuming you have a Gallery control named GalleryOrders
    // Set the default values of the dropdown and text input based on the selected record in the gallery
    DropdownRevision.Default = GalleryOrders.Selected.Revision;
    txtRevision.Default = GalleryOrders.Selected.Revision;
  • kritika26 Profile Picture
    25 on at

    but now if we increment value that is not updated in dropdown bcz when we increment, latest value should come and when we come from gallery particular revision of that product should come

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