cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nliu
Helper II
Helper II

Multiple datasource

Hello,

 

I have 6 SP Lists with the same structure and I would like to submit a form directly in the right SP List depending on what the user choose "DTE CA" button  or "DTE Sud" button etc on the first screen, is it possible ?

 

thank you

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User III
Super User III

If the form and the buttons on the same screen then I propose this:

Generally you can do this by Patch:

Patch(DataSource,Defaults(DataSource),{ColumnName1: Input1.Text, ColumnName2: Input2.Text, ColumnName3: Input3.Text}) 

 

Kindly follow the following:

On Button1

Patch(SP1,Defaults(SP1),{ColumnName1: DatacardValue1.Text ColumnName2: DatacardValue2.Text,    ColumnName3: DatacardValue3.Text })

 

On Button2

Patch(SP2,Defaults(SP2),{ColumnName1: DatacardValue1.Text ColumnName2: DatacardValue2.Text,    ColumnName3: DatacardValue3.Text })

 

On Button3

Patch(SP3,Defaults(SP3),{ColumnName1: DatacardValue1.Text ColumnName2: DatacardValue2.Text,    ColumnName3: DatacardValue3.Text })

 

Note: Replace with your real SP List name, ColumnNames and Datacarvalue names on your form.

         Repeat same for the rest of the button by changing the datasource only to SP4, SP5, SP6

View solution in original post

5 REPLIES 5
eka24
Super User III
Super User III

If the form and the buttons on the same screen then I propose this:

Generally you can do this by Patch:

Patch(DataSource,Defaults(DataSource),{ColumnName1: Input1.Text, ColumnName2: Input2.Text, ColumnName3: Input3.Text}) 

 

Kindly follow the following:

On Button1

Patch(SP1,Defaults(SP1),{ColumnName1: DatacardValue1.Text ColumnName2: DatacardValue2.Text,    ColumnName3: DatacardValue3.Text })

 

On Button2

Patch(SP2,Defaults(SP2),{ColumnName1: DatacardValue1.Text ColumnName2: DatacardValue2.Text,    ColumnName3: DatacardValue3.Text })

 

On Button3

Patch(SP3,Defaults(SP3),{ColumnName1: DatacardValue1.Text ColumnName2: DatacardValue2.Text,    ColumnName3: DatacardValue3.Text })

 

Note: Replace with your real SP List name, ColumnNames and Datacarvalue names on your form.

         Repeat same for the rest of the button by changing the datasource only to SP4, SP5, SP6

View solution in original post

MrNappa
Advocate V
Advocate V

I get the impression you want to first pick the list from a button in the screenshot you posted, then show an edit form to make updates to a value. I'm not sure if an EditForm is versatile enough to support a variable Datasource, even if the sources you will pick from are the same in structure. You could try it with a variable, but I doubt that will work.

 

So, you'll probably have to resort to manual patching.

 

For example:

 

 

Switch( selectedSPList,
  "DTE CA", Patch( 'DTE CA', editedRecord, EditForm.Updates );,
  "DTE sud", Patch( 'DTE Sud', editedRecord, EditForm.Updates );
  .. etc ..
);

 

 

(Note: maybe

  Patch(  Switch( selectedSPList, "DTE CA", 'DTE CA', "DTE sud", 'DTE Sud' ), editedRecord, EditForm.Updates );

will work? but I'm not sure)

 

/edit: Oh, I forgot to mention: the drawback of this is that you can't use the default input checks/error handling that an Editform provides. Make sure you handle that yourself!

Thanks for your answers, I tried with the Switch function but it doesn't work, so I did the pacth function for the moment... But I'm still trying to find another way to do it !

eka24
Super User III
Super User III

Can you copy and paste one of Patch formulas for correction it it didn't work

If(
TargetScreen3="NewForm";
Patch('ESU - DT';Defaults('ESU - DT');
{ Structuredelenduitsuperficiel: DataCardValue22.Selected.Value;
Ville_x002f_Commune: DataCardValue101.Text;
D_x00e9_partement: DataCardValue115.Selected;
Typedeliant: DataCardValue113.Selected;
Nomduliant: DataCardValue98.SelectedItems;
P_x00e9_riodeder_x00e9_alisation: DataCardValue102.SelectedDate;
Coordonn_x00e9_esGPS: DataCardValue24.Text;
PRx_x00e0_x: DataCardValue23.Text;
Surfacetotaleduchantier_x0028_m_: Value(DataCardValue25.Text);
Trafic_x0028_PL_x002f_j_x002f_se: DataCardValue96.Selected });

Patch('ESU - DT'; LookUp('ESU - DT';'Structure de l''enduit superficiel' = DataCardValue22.SelectedText.Value && 'Ville/Commune' = DataCardValue101.Text && 'Période de réalisation' = DataCardValue102.SelectedDate);
{ Structuredelenduitsuperficiel: DataCardValue22.Selected.Value;
Ville_x002f_Commune: DataCardValue101.Text;
D_x00e9_partement: DataCardValue115.Selected;
Typedeliant: DataCardValue113.Selected;
Nomduliant: DataCardValue98.SelectedItems;
P_x00e9_riodeder_x00e9_alisation: DataCardValue102.SelectedDate;
Coordonn_x00e9_esGPS: DataCardValue24.Text;
PRx_x00e0_x: DataCardValue23.Text;
Surfacetotaleduchantier_x0028_m_: Value(DataCardValue25.Text);
Trafic_x0028_PL_x002f_j_x002f_se: DataCardValue96.Selected }));;

 

If(
myTarget = "DTESUD" && TargetScreen3="NewForm";
Patch('ESU - SUD';Defaults('ESU - SUD');
{ Structuredelenduitsuperficiel: DataCardValue22.Selected.Value;
Ville_x002f_Commune: DataCardValue101.Text;
D_x00e9_partement: DataCardValue115.Selected;
Typedeliant: DataCardValue113.Selected;
Nomduliant: DataCardValue98.SelectedItems;
P_x00e9_riodeder_x00e9_alisation: DataCardValue102.SelectedDate;
Coordonn_x00e9_esGPS: DataCardValue24.Text;
PRx_x00e0_x: DataCardValue23.Text;
Surfacetotaleduchantier_x0028_m_: Value(DataCardValue25.Text);
Trafic_x0028_PL_x002f_j_x002f_se: DataCardValue96.Selected});

Patch('ESU - SUD'; LookUp('ESU - SUD';'Structure de l''enduit superficiel' = DataCardValue22.SelectedText.Value && 'Ville/Commune' = DataCardValue101.Text && 'Période de réalisation' = DataCardValue102.SelectedDate);
{ Structuredelenduitsuperficiel: DataCardValue22.Selected.Value;
Ville_x002f_Commune: DataCardValue101.Text;
D_x00e9_partement: DataCardValue115.Selected;
Typedeliant: DataCardValue113.Selected;
Nomduliant: DataCardValue98.SelectedItems;
P_x00e9_riodeder_x00e9_alisation: DataCardValue102.SelectedDate;
Coordonn_x00e9_esGPS: DataCardValue24.Text;
PRx_x00e0_x: DataCardValue23.Text;
Surfacetotaleduchantier_x0028_m_: Value(DataCardValue25.Text);
Trafic_x0028_PL_x002f_j_x002f_se: DataCardValue96.Selected}));;

 

If(
myTarget = "DTEOA" && TargetScreen3="NewForm";
Patch('ESU - OA';Defaults('ESU - OA');
{ Structuredelenduitsuperficiel: DataCardValue22.Selected.Value;
Ville_x002f_Commune: DataCardValue101.Text;
D_x00e9_partement: DataCardValue115.Selected;
Typedeliant: DataCardValue113.Selected;
Nomduliant: DataCardValue98.SelectedItems;
P_x00e9_riodeder_x00e9_alisation: DataCardValue102.SelectedDate;
Coordonn_x00e9_esGPS: DataCardValue24.Text;
PRx_x00e0_x: DataCardValue23.Text;
Surfacetotaleduchantier_x0028_m_: Value(DataCardValue25.Text);
Trafic_x0028_PL_x002f_j_x002f_se: DataCardValue96.Selected});

Patch('ESU - OA'; LookUp('ESU - OA';'Structure de l''enduit superficiel' = DataCardValue22.SelectedText.Value && 'Ville/Commune' = DataCardValue101.Text && 'Période de réalisation' = DataCardValue102.SelectedDate);
{ Structuredelenduitsuperficiel: DataCardValue22.Selected.Value;
Ville_x002f_Commune: DataCardValue101.Text;
D_x00e9_partement: DataCardValue115.Selected;
Typedeliant: DataCardValue113.Selected;
Nomduliant: DataCardValue98.SelectedItems;
P_x00e9_riodeder_x00e9_alisation: DataCardValue102.SelectedDate;
Coordonn_x00e9_esGPS: DataCardValue24.Text;
PRx_x00e0_x: DataCardValue23.Text;
Surfacetotaleduchantier_x0028_m_: Value(DataCardValue25.Text);
Trafic_x0028_PL_x002f_j_x002f_se: DataCardValue96.Selected}));;

 

If(
myTarget = "DTEIDFN" && TargetScreen3="NewForm";
Patch('ESU - IDFN';Defaults('ESU - IDFN');
{ Structuredelenduitsuperficiel: DataCardValue22.Selected.Value;
Ville_x002f_Commune: DataCardValue101.Text;
D_x00e9_partement: DataCardValue115.Selected;
Typedeliant: DataCardValue113.Selected;
Nomduliant: DataCardValue98.SelectedItems;
P_x00e9_riodeder_x00e9_alisation: DataCardValue102.SelectedDate;
Coordonn_x00e9_esGPS: DataCardValue24.Text;
PRx_x00e0_x: DataCardValue23.Text;
Surfacetotaleduchantier_x0028_m_: Value(DataCardValue25.Text);
Trafic_x0028_PL_x002f_j_x002f_se: DataCardValue96.Selected});

Patch('ESU - IDFN'; LookUp('ESU - IDFN';'Structure de l''enduit superficiel' = DataCardValue22.SelectedText.Value && 'Ville/Commune' = DataCardValue101.Text && 'Période de réalisation' = DataCardValue102.SelectedDate);
{ Structuredelenduitsuperficiel: DataCardValue22.Selected.Value;
Ville_x002f_Commune: DataCardValue101.Text;
D_x00e9_partement: DataCardValue115.Selected;
Typedeliant: DataCardValue113.Selected;
Nomduliant: DataCardValue98.SelectedItems;
P_x00e9_riodeder_x00e9_alisation: DataCardValue102.SelectedDate;
Coordonn_x00e9_esGPS: DataCardValue24.Text;
PRx_x00e0_x: DataCardValue23.Text;
Surfacetotaleduchantier_x0028_m_: Value(DataCardValue25.Text);
Trafic_x0028_PL_x002f_j_x002f_se: DataCardValue96.Selected}));;

 

If(
myTarget = "DTECE" && TargetScreen3="NewForm";
Patch('ESU - CE';Defaults('ESU - CE');
{ Structuredelenduitsuperficiel: DataCardValue22.Selected.Value;
Ville_x002f_Commune: DataCardValue101.Text;
D_x00e9_partement: DataCardValue115.Selected;
Typedeliant: DataCardValue113.Selected;
Nomduliant: DataCardValue98.SelectedItems;
P_x00e9_riodeder_x00e9_alisation: DataCardValue102.SelectedDate;
Coordonn_x00e9_esGPS: DataCardValue24.Text;
PRx_x00e0_x: DataCardValue23.Text;
Surfacetotaleduchantier_x0028_m_: Value(DataCardValue25.Text);
Trafic_x0028_PL_x002f_j_x002f_se: DataCardValue96.Selected});

Patch('ESU - CE'; LookUp('ESU - CE';'Structure de l''enduit superficiel' = DataCardValue22.SelectedText.Value && 'Ville/Commune' = DataCardValue101.Text && 'Période de réalisation' = DataCardValue102.SelectedDate);
{ Structuredelenduitsuperficiel: DataCardValue22.Selected.Value;
Ville_x002f_Commune: DataCardValue101.Text;
D_x00e9_partement: DataCardValue115.Selected;
Typedeliant: DataCardValue113.Selected;
Nomduliant: DataCardValue98.SelectedItems;
P_x00e9_riodeder_x00e9_alisation: DataCardValue102.SelectedDate;
Coordonn_x00e9_esGPS: DataCardValue24.Text;
PRx_x00e0_x: DataCardValue23.Text;
Surfacetotaleduchantier_x0028_m_: Value(DataCardValue25.Text);
Trafic_x0028_PL_x002f_j_x002f_se: DataCardValue96.Selected}));;

 

If(
myTarget = "DTECA" && TargetScreen3="NewForm";
Patch('ESU - CA';Defaults('ESU - CA');
{ Structuredelenduitsuperficiel: DataCardValue22.Selected.Value;
Ville_x002f_Commune: DataCardValue101.Text;
D_x00e9_partement: DataCardValue115.Selected;
Typedeliant: DataCardValue113.Selected;
Nomduliant: DataCardValue98.SelectedItems;
P_x00e9_riodeder_x00e9_alisation: DataCardValue102.SelectedDate;
Coordonn_x00e9_esGPS: DataCardValue24.Text;
PRx_x00e0_x: DataCardValue23.Text;
Surfacetotaleduchantier_x0028_m_: Value(DataCardValue25.Text);
Trafic_x0028_PL_x002f_j_x002f_se: DataCardValue96.Selected});

Patch('ESU - CA'; LookUp('ESU - CA';'Structure de l''enduit superficiel' = DataCardValue22.SelectedText.Value && 'Ville/Commune' = DataCardValue101.Text && 'Période de réalisation' = DataCardValue102.SelectedDate);
{ Structuredelenduitsuperficiel: DataCardValue22.Selected.Value;
Ville_x002f_Commune: DataCardValue101.Text;
D_x00e9_partement: DataCardValue115.Selected;
Typedeliant: DataCardValue113.Selected;
Nomduliant: DataCardValue98.SelectedItems;
P_x00e9_riodeder_x00e9_alisation: DataCardValue102.SelectedDate;
Coordonn_x00e9_esGPS: DataCardValue24.Text;
PRx_x00e0_x: DataCardValue23.Text;
Surfacetotaleduchantier_x0028_m_: Value(DataCardValue25.Text);
Trafic_x0028_PL_x002f_j_x002f_se: DataCardValue96.Selected}));;


If(
myTarget = "DTENEB" && TargetScreen3="NewForm";
Patch('ESU - NEB';Defaults('ESU - NEB');
{ Structuredelenduitsuperficiel: DataCardValue22.Selected.Value;
Ville_x002f_Commune: DataCardValue101.Text;
D_x00e9_partement: DataCardValue115.Selected;
Typedeliant: DataCardValue113.Selected;
Nomduliant: DataCardValue98.SelectedItems;
P_x00e9_riodeder_x00e9_alisation: DataCardValue102.SelectedDate;
Coordonn_x00e9_esGPS: DataCardValue24.Text;
PRx_x00e0_x: DataCardValue23.Text;
Surfacetotaleduchantier_x0028_m_: Value(DataCardValue25.Text);
Trafic_x0028_PL_x002f_j_x002f_se: DataCardValue96.Selected});

Patch('ESU - NEB'; LookUp('ESU - NEB';'Structure de l''enduit superficiel' = DataCardValue22.SelectedText.Value && 'Ville/Commune' = DataCardValue101.Text && 'Période de réalisation' = DataCardValue102.SelectedDate);
{ Structuredelenduitsuperficiel: DataCardValue22.Selected.Value;
Ville_x002f_Commune: DataCardValue101.Text;
D_x00e9_partement: DataCardValue115.Selected;
Typedeliant: DataCardValue113.Selected;
Nomduliant: DataCardValue98.SelectedItems;
P_x00e9_riodeder_x00e9_alisation: DataCardValue102.SelectedDate;
Coordonn_x00e9_esGPS: DataCardValue24.Text;
PRx_x00e0_x: DataCardValue23.Text;
Surfacetotaleduchantier_x0028_m_: Value(DataCardValue25.Text);
Trafic_x0028_PL_x002f_j_x002f_se: DataCardValue96.Selected}))

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 (1,178)