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 / Update Position Number...
Power Apps
Unanswered

Update Position Number to Sharepoint List with Drag and Drop PCF

(0) ShareShare
ReportReport
Posted on by 6

Hello!

 

I have a Sharepoint list called 'tblProduct' which contains a column 'Order' which defines an arbitrary order for the list. I also created collection called 'products_filtered' to use with the Drag and Drop PCF by Scott Durow. 

 

 

 

ClearCollect(products_filtered,
 AddColumns(
 Sort(Filter(tblProduct,Area1=6,Obsolete=false),Order),
 "Zone","assigned"
 )
);

 

 

 

I have setup the Drag and drop control successfully but I want to save that specific order when you drag and drop items to my Sharepoint list. I am able to save the position of that dragged item. Unfortunately this only changes the order of that item and not all the other items.

 

 

 

Patch(tblProduct,
LookUp(tblProduct,ID=Value(CtlDragDrop.DroppedId)),
{Order:CtlDragDrop.DroppedPosition}
)

 

 

 

I have tried some solutions found on the internet such as generating a row number but for some reason, the order stays the same when I drag items.

 

 

 

// Generate row number code
ClearCollect(
 colSolution,
 ForAll(
 Sequence(CountRows(colMyCollection)),
 Patch(
 Last(FirstN(colMyCollection, Value)),
 {RowNumber: Value}
 )
 )
)

 

 

 I'm new to PowerApps. If you could please guide me into what should I do I would be very grateful.

 

Thank you.

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    Hi @antoniovzgr ,

    A slightly condensed version (there is nothing wrong with the one you have)

    ClearCollect(
       colSolution,
       ForAll(
          Sequence(CountRows(colMyCollection)),
          Patch(
             Index(
                colMyCollection, 
                Value
             ),
             {RowNumber: Value}
          )
       )
    )

    will generate a new field called RowNumber which will be sequential to the current order (unsorted) that exists in colMyCollection. Is the the result you are expecting ?

     Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    LinkedIn    Buy me a coffee

     

  • antoniovzgr Profile Picture
    6 on at

    Thank you, Warren

     

    I appreciate you response. I tried your solution for the row number and it worked very well. However, it turns out that the PCF has a field for the row position.

     

    So what I did was first I created a collection to store those positions generated:

    ClearCollect(colSolution, MasterDrag.CurrentItems);

     

    Then I patched those positions to the original Sharepoint List:

    ForAll(
     ShowColumns(colSolution,"ItemId", "Position"),
     Patch(tblProduct,tblProduct, 
     LookUp(tblProduct, ID =Value(ItemId) ), 
     {Order: Value(Position)})
    );

     

    And now the positions are updated in the original list.

     

    However, it takes a little bit of time doing that operation. See any improvements I can make to speed it up a little bit?

     

    Thank you.

  • WarrenBelz Profile Picture
    153,034 Most Valuable Professional on at

    @antoniovzgr 

    Not that I can see. I am also not familiar with that control.

  • jsmith87 Profile Picture
    297 on at
     
    Hi, did you ever manage to finish this project? I'm trying to do it now and I'm on the third video where you can save drag and drop items but I'm stuck on one particular thing (where varSelectedDate) was set from. Wondering if you're able to shed some light on to it?

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 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard