cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
chriss59194
Frequent Visitor

newform avec recuperation champs galery

Bonjour

 

j'aurai encore besoin de votre aide.

j’ai une galery1 avec une liste d’éléments, quand je clic sur un élément onselect : Navigate(FORM1)

une fois dans mon formulaire j’ai un champs ID qui reprend mon ID de ma galery1 sélectionné, Item :LookUp ('FORM1';ID = galery1. Selected.ID)

 

ce formulaire fait un enregistrement sur une source de donnée google Sheets autre que celle de ma galery1

 

par contre j’ai besoin de votre aide car quand je clic sur enregistrer : SubmitForm(FORM1), il me modifie mes champs sur ma source de donnée google Sheets lié a mon ID, mais je voudrais plutôt créer un nouvel enregistrement tout en gardant mon ID sélectionné sur ma galery1.

 

J’ai essayer avec newform(FORM1) mais ca ne marche pas.

 

MERCI

4 REPLIES 4
Drrickryp
Super User II
Super User II

Bonjour @chriss59194 

You can arrange your form so that it works as it is supposed to. Every properly constructed table in a database should have a unique ID field that is not reused if the record is deleted. Since both Excel and Google sheets does not assign its own ID to a table, you have to do it yourself.  You can use the same form for a New as well as Editing an existing record.  The function NewForm( Form1) and EditForm(Form1) establishes the proper milieu and should be used in the command that Navigates to the form from another screen. 

When you create a new record using the NewForm(Form1) function you will need to assign a new record number to your google sheets so you would make the default for the ID field .

 

Coalesce(
          Parent.Default, First(
                                 Sort(
                                       Table, ID, Descending
                                  )
                            ).ID+1
)

 

If you are Navigating to the form to modify an existing record use EditForm(Form1) with the Navigate() function. This way the Form is in Edit mode.  Then the function above will use the Parent.Default but if it is in New form mode, then Parent.Default will be blank and the formula above will assign the next ID in sequence to the ID field  It is important to either hide or disable this card to the User cannot change it.

If you want to keep a relationship to the table in your gallery (say if it was a Parent/Child relationship between two different tables, you would need to have the Parent ID in the Child table as the parentID field.  It should be a number in the second table, In the Form, there will be a card for it.  Inside the card for the parentID, there will be a control and its Default property should be set to Gallery.Selected.ID.  Also disable this card so it can't be changed by the user.  To better understand how to use Keys to create the relationships between tables in your app, please see my blog here https://powerusers.microsoft.com/t5/News-Announcements/Relational-Database-Principles-and-PowerApps-... .  The post following it shows how to implement that relationship in PowerApps.   https://powerusers.microsoft.com/t5/PowerApps-Community-Blog/Relational-Database-Design-fundamentals...  

chriss59194
Frequent Visitor

bonjour,

en fait mon ID provient d’une liste d’équipement et mon formulaire les pannes sur l’ID de l’équipement en question donc dans ma table de donnée je vais retrouvé plusieurs ligne avec le même ID, c'est pour cela que dan s mon formulaire j’ai récupéré mon ID de ma galery1, avec un ITEM : :LookUp ('FORM1';ID = galery1. Selected.ID)

mais quand j’enregistre il me fait une modification alors que je voudrais qu’il crée une nouvelle ligne

Drrickryp
Super User II
Super User II

@chriss59194 

If your list has several ID's that match the one selected in your gallery, Lookup will find the first one, not necessarily the one you want.  Also check the Update property of the card containing this field.  It may not be reflecting the value in the control inside the card. 

chriss59194
Frequent Visitor

J'ai 2 table une avec la liste de mes équipement avec 1 seul ID par équipement ( ma galery1) est une 2ieme table avec les enregistrements de panne avec plusieurs ID (FORM1) 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (875)