cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vinc1992
Helper I
Helper I

Move Items up and down in Gallery (based on Table)

Hi everyone,

 

based on the video from April (https://www.youtube.com/watch?v=vuBuPxOY8uM) I built the following code. The difference to April's code is that I want to directly switch the order in gallery based on a table and not use a helpcollection. 

 

Unfortunatly I got the Error to define the PowerAppID. Have somebody an idea?

 

Looking forward to hearing from you 🙂

 

 

Select(Parent);;
UpdateContext({previousRecord:LookUp(
Tabelle10;
Order=ThisItem.Order-1)
});;
Update(
Tabelle10;
previousRecord;
{
Verteiler: previousRecord.Verteiler;
Name: previousRecord.Name;
Firma: previousRecord.Firma;
Funktion: previousRecord.Funktion;
Telefon: previousRecord.Telefon;
email: previousRecord.email;
Order: ThisItem.Order;
ProjektNr: previousRecord.ProjektNr
}
);;
Update(
Tabelle10;
ThisItem;
{
Verteiler: ThisItem.Verteiler;
Name: ThisItem.Name;
Firma: ThisItem.Firma;
Funktion: ThisItem.Funktion;
Telefon: ThisItem.Telefon;
email: ThisItem.email;
Order: previousRecord.Order;
ProjektNr: ThisItem.ProjektNr
}
)

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @WarrenBelz ,

 

thanks for your response. Unfortunatly he cant find the field ID.

 

I try it just by changig Update to Patch. These seem to work.  Thx a lot. Below the code:

 

Select(Parent);;
UpdateContext({previousRecord:LookUp(
Tabelle10;
Order=ThisItem.Order-1)
});;
Patch(
Tabelle10;
previousRecord;
{
Verteiler: previousRecord.Verteiler;
Name: previousRecord.Name;
Firma: previousRecord.Firma;
Funktion: previousRecord.Funktion;
Telefon: previousRecord.Telefon;
email: previousRecord.email;
Order: ThisItem.Order;
ProjektNr: previousRecord.ProjektNr
}
);;
Patch(
Tabelle10;
ThisItem;
{
Verteiler: ThisItem.Verteiler;
Name: ThisItem.Name;
Firma: ThisItem.Firma;
Funktion: ThisItem.Funktion;
Telefon: ThisItem.Telefon;
email: ThisItem.email;
Order: previousRecord.Order;
ProjektNr: ThisItem.ProjektNr
}
)

 

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @vinc1992 ,

This should do it if I have read your requirements correctly

Select(Parent);;
UpdateContext(
   {
      previousRecord:
      LookUp(
         Tabelle10;
         Order = ThisItem.Order - 1
      )
   }
);;
Patch(
   Tabelle10;
   {ID:previousRecord.ID};
   {
      Verteiler: previousRecord.Verteiler;
      Name: previousRecord.Name;
      Firma: previousRecord.Firma;
      Funktion: previousRecord.Funktion;
      Telefon: previousRecord.Telefon;
      email: previousRecord.email;
      Order: ThisItem.Order;
      ProjektNr: previousRecord.ProjektNr   
   }
);;
Patch(
   Tabelle10;
   {ID: ThisItem.ID};
   {
      Verteiler: ThisItem.Verteiler;
      Name: ThisItem.Name;
      Firma: ThisItem.Firma;
      Funktion: ThisItem.Funktion;
      Telefon: ThisItem.Telefon;
      email: ThisItem.email;
      Order: previousRecord.Order;
      ProjektNr: ThisItem.ProjektNr
   }
)

 

Please click Accept as solution 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 Thumbs Up.

Visit my blog Practical Power Apps

Hi @WarrenBelz ,

 

thanks for your response. Unfortunatly he cant find the field ID.

 

I try it just by changig Update to Patch. These seem to work.  Thx a lot. Below the code:

 

Select(Parent);;
UpdateContext({previousRecord:LookUp(
Tabelle10;
Order=ThisItem.Order-1)
});;
Patch(
Tabelle10;
previousRecord;
{
Verteiler: previousRecord.Verteiler;
Name: previousRecord.Name;
Firma: previousRecord.Firma;
Funktion: previousRecord.Funktion;
Telefon: previousRecord.Telefon;
email: previousRecord.email;
Order: ThisItem.Order;
ProjektNr: previousRecord.ProjektNr
}
);;
Patch(
Tabelle10;
ThisItem;
{
Verteiler: ThisItem.Verteiler;
Name: ThisItem.Name;
Firma: ThisItem.Firma;
Funktion: ThisItem.Funktion;
Telefon: ThisItem.Telefon;
email: ThisItem.email;
Order: previousRecord.Order;
ProjektNr: ThisItem.ProjektNr
}
)

 

@vinc1992 ,

Yes, that would work as well (looks pretty close to what I posted, but ID is better if you can get it). I assume my post assisted you to get there.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (6,229)