cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Prodigy
Post Prodigy

I AM TRYING SAVING TWO DROPDOWNS IN A PATCH AND I CANT SAVE IN SP LIST

WHAT AM  I DOING WRONG? I M TRYING SAVING TWO DROPDOWN IN SP LIST AND I CANT GET IT.

 

FOLLOW THE PRINT: 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Post Prodigy
Post Prodigy

Re: I AM TRYING SAVING TWO DROPDOWNS IN A PATCH AND I CANT SAVE IN SP LIST

i found the solution was in the: ForAll(Gallery1.AllItems....

 

And the rest of the code

 

Thanks all for the help! 😄

View solution in original post

10 REPLIES 10
Highlighted
Community Support
Community Support

Re: I AM TRYING SAVING TWO DROPDOWNS IN A PATCH AND I CANT SAVE IN SP LIST

Hi @Gorilla_8 ,

Could you please share a bit more about the 'Centro de Custo' column and 'Tipo de Despesa' column in your SP list? Are they both LookUp type column or Choice type column?

 

Based on your scenario that you mentioned, I suppose that the 'Centro de Custo' column and 'Tipo de Despesa' column are both LookUp type column in your SP list, is it true?

 

According to the formula you provided above, I think there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

Please consider modify your formula as below:

ForAll(
       ExpenseCollection;
       If(
           !IsBlank(LineItem);
           Patch(
                  ExpenseDetails;
                  Defaults(ExpenseDetails);
                  {
                     Titulo: LineItem;
                     ...
                     CentroDeCusto: {
                                      Id: LookUp(ReferencedList; ReferencedColumn = inputItemCentroDeCusto.Selected.Value; ID);
                                      Value: inputItemCentroDeCusto.Selected.Value
                                    };
                     TipoDeDespesa: {
                                     Id: LookUp(ReferencedList2; ReferencedColumn2 = inputTipoDeDespesa.Selected.Value; ID);
                                     Value: inputTipoDeDespesa.Selected.Value
                     };
                      ....
                      ....
                  }
           )
       )
)

Note: I assume that the 'Centro de Custo' column reference values from the ReferencedColumn in ReferencedList1, and the 'Tipo de Despesa' column references values from the ReferencedColumn2 in ReferencedList2. ReferencedList1 and ReferencedList2 are both SP List data source.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Post Prodigy
Post Prodigy

Re: I AM TRYING SAVING TWO DROPDOWNS IN A PATCH AND I CANT SAVE IN SP LIST

No, there are a choice column...

Highlighted
Post Prodigy
Post Prodigy

Re: I AM TRYING SAVING TWO DROPDOWNS IN A PATCH AND I CANT SAVE IN SP LIST

cantsavedateincollection.png

 

See the print

Highlighted
Post Prodigy
Post Prodigy

Re: I AM TRYING SAVING TWO DROPDOWNS IN A PATCH AND I CANT SAVE IN SP LIST

The "centrodecusto" is saving but the another one its not, i dont know why

Highlighted
Community Support
Community Support

Re: I AM TRYING SAVING TWO DROPDOWNS IN A PATCH AND I CANT SAVE IN SP LIST

Hi @Gorilla_8 ,

Are the 'Centro de Custo' column and 'Tipo de Despesa' column both Choice type column in your SP list?

 

If the 'Centro de Custo' column and 'Tipo de Despesa' column are both Choice type column in your SP list, please consider modify your formula as below:

ForAll(
       ExpenseCollection;
       If(
           !IsBlank(LineItem);
           Patch(
                  ExpenseDetails;
                  Defaults(ExpenseDetails);
                  {
                     Titulo: LineItem;
                     ...
                     CentroDeCusto: {
                                      Value: inputItemCentroDeCusto.Selected.Value
                                    };
                     TipoDeDespesa: {
                                     Value: inputTipoDeDespesa.Selected.Value
                     };               // On your side, do not miss the close '}' symbol for TipoDeDespesa
                      ....
                      ....
                  }
           )
       )
)

 

Please check and see if the following blog would help in your scenario:

https://powerapps.microsoft.com/en-us/blog/default-values-for-complex-sharepoint-types/?utm_source=p...

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Post Prodigy
Post Prodigy

Re: I AM TRYING SAVING TWO DROPDOWNS IN A PATCH AND I CANT SAVE IN SP LIST

Its saving the field, but not the choices in the cards...

 

 

see the code:

 

TipodeDespesa:{ Value: inputTipoDeDespesa.Selected.Value};
CentroDeCusto:{ Value: inputItemCentroDeCusto.Selected.Value}

Highlighted
Community Support
Community Support

Re: I AM TRYING SAVING TWO DROPDOWNS IN A PATCH AND I CANT SAVE IN SP LIST

Hi @Gorilla_8 ,

Could you please share a bit more about the "Its saving the field, but not the choices in the cards"? What do you mean?

Do you mean the Patch function could save other field values back to your SP list, but not the two Choices type column values?

Is there something error with your Patch function?

 

Please check if the 'CentroDeCusto' field and 'TipoDeDespesa' field are both Choice type, or one LookUp field and another one is Choice? Do the two Choice type columns enable the "Allow Multiple selections" option?

Based on the needs that you mentioned, I think the solution I provided above could achieve your needs. Please share more details about the data structure of the 'CentroDeCusto' field and 'TipoDeDespesa' field in your SP List.

 

If the issue still exists, please re-generate a new app based on your SP List, then try the following formula again, check if the issue is solved:

ForAll(
       ExpenseCollection;
       If(
           !IsBlank(LineItem);
           Patch(
                  ExpenseDetails;
                  Defaults(ExpenseDetails);
                  {
                     Titulo: LineItem;
                     ...
                     CentroDeCusto: {
                                      Value: inputItemCentroDeCusto.Selected.Value
                                    };
                     TipoDeDespesa: {
                                     Value: inputTipoDeDespesa.Selected.Value
                     };               // On your side, do not miss the close '}' symbol for TipoDeDespesa
                      ....
                      ....
                  }
           )
       )
)

If you enable "Allow Multiple Selections" for  'CentroDeCusto' field and 'TipoDeDespesa' field, please modify above formula as below:

ForAll(
       ExpenseCollection;
       If(
           !IsBlank(LineItem);
           Patch(
                  ExpenseDetails;
                  Defaults(ExpenseDetails);
                  {
                     Titulo: LineItem;
                     ...
                     CentroDeCusto: Table({
                                      Value: inputItemCentroDeCusto.Selected.Value
                                    });  // On your side, do not miss the close '}' symbol for CentroDeCusto field 
                     TipoDeDespesa: Table({
                                     Value: inputTipoDeDespesa.Selected.Value
                     });               // On your side, do not miss the close '}' symbol for TipoDeDespesa field 
                      ....
                      ....
                  }
           )
       )
)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Post Prodigy
Post Prodigy

Re: I AM TRYING SAVING TWO DROPDOWNS IN A PATCH AND I CANT SAVE IN SP LIST

Its a choice field, follow the code: 

 

ForAll(ExpenseCollection;If(!IsBlank(LineItem);
Patch(ExpenseDetails; Defaults(ExpenseDetails);
{Title: LineItem;
ItemCost: LineCost;
MasterID: Form1.LastSubmit.ID;
Viagem_destino: LineViagem_Destino;
DataDaViagem: DateValue(LineDataDaViagem);
Moeda_Viagem: Value(LineMoeda_Viagem);
TaxaDaViagem: Value(LineTaxaDaViagem);
DataDoReembolso: DateValue(LineDataDoReembolso);
N_x00fa_meroDoDocumento: Value(LineNumeroDoDocumento);
DescricaoDoReembolso: Text(LineDescricaoDoReembolso);
ValorGastoItemViagem: Value(LineValorGastoItemViagem);
ValorGastoItemEmReaisVALORFINAL: Value(LineValorGastoItemReaisValorFinal);
TipodeDespesa: { Value: inputTipoDeDespesa.Selected.Value};
CentroDeCusto:{ Value: inputItemCentroDeCusto.Selected.Value}})))

 

 

And then in the button save:

 

Patch(ExpenseCollection;

ThisItem; {LineItem: inputItem.Text;

LineCost: Value(inputCost.Text);

LineViagem_Destino: inputViagem_Destino.Text;

LineMoeda_Viagem: Value(inputMoeda_Viagem.Text);

LineTaxaDaViagem: Value(inputTaxaDaViagem.Text);

LineDataDoReembolso: DateValue(Text(inputDataDoReembolso));

LineNumeroDoDocumento: Value(inputNumeroDoDocumento.Text);

LineCentroDeCusto: inputItemCentroDeCusto.Selected.Value;

LineTipoDeDespesa: inputTipoDeDespesa.Selected.Value;

LineDataDaViagem: DateValue(Text(inputDataDaViagem)) ;

LineValorGastoItemViagem: Value(c.Text);

LineValorGastoItemReaisValorFinal: Value(inputItemValorGastoItemReaisValorFinal.Text);

LineDescricaoDoReembolso: inputDescricaoDoReembolso.Text;

ShowSaveButtons:false});;

If(EditPressed; false; Collect(ExpenseCollection; {LineItem: ""; LineCost: 0; LineViagem_Destino: "" ; LineMoeda_Viagem: 0; LineDataDaViagem:""; LineTaxaDaViagem: 0 ; LineDataDoReembolso:""; LineNumeroDoDocumento: 0; LineCentroDeCusto:""; LineTipoDeDespesa:""; LineValorGastoItemViagem:0;LineValorGastoItemReaisValorFinal: 0;LineDescricaoDoReembolso:"";ShowSaveButtons:true}));;UpdateContext({EditPressed:false});;Set(NeedsSaved; false)

 

 

and then in the button to create the collection: NewForm(Form1);;ClearCollect(ExpenseCollection; {LineItem: ""; LineCost: 0; LineViagem_Destino: ""; LineMoeda_Viagem: 0; LineDataDaViagem:"" ; LineTaxaDaViagem:0; LineDataDoReembolso:""; LineNumeroDoDocumento: 0; LineCentroDeCusto: ""; LineTipoDeDespesa:""; LineValorGastoItemViagem:0; LineValorGastoItemReaisValorFinal:0; LineDescricaoDoReembolso:""; LineResumo_Alimentação: ""; ShowSaveButtons: true}) ;;Navigate(NewItem;ScreenTransition.Cover)

Highlighted
Post Prodigy
Post Prodigy

Re: I AM TRYING SAVING TWO DROPDOWNS IN A PATCH AND I CANT SAVE IN SP LIST

TipodeDespesa: { Value: inputTipoDeDespesa.Selected.Value};
CentroDeCusto:{ Value: inputItemCentroDeCusto.Selected.Value}

 

In this way he save if i send one item to save in SP, but if i make more itens in gallery he didnt get it

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,736)