cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
twister
Post Patron
Post Patron

patch dropdown to sharepoint list

Hi, wanna ask what is the valid patch function for dropdown/choice? I have tried with no error but data not save in my sharepoint list.

 

I have 2 dropdown menu with single selection which is tax & currency.. all record succesfully save in sharepointlist after submit except tax & currency which is datatype is Choice.

 

twister_0-1618543841477.png

 

Clear Collect:

 

ClearCollect(
    colApp,
    {
        invoiceno: "",
        invoicedate: Blank(),
        invoiceamount: 0,
        paymentref: "",
        paymentdate: Blank(),
        paymentamount: 0,
        days: 0,
        percentsales: 0,
        amountsales: 0,
        tax: "6",
        currency: "AUD",
        ShowSaveButton: true
    }
),

 

 

Patch to collection:

 

Patch(
    colApp,
    ThisItem,
    {
        invoiceno: TextInput1.Text,
        invoicedate: DatePicker1.SelectedDate,
        invoiceamount: Value(TextInput2.Text),
        paymentref: TextInput6.Text,
        paymentdate: DatePicker2.SelectedDate,
        paymentamount: Value(TextInput7.Text),
        days: Value(TextInput24.Text),
        percentsales: Value(TextInput23.Text),
        amountsales: Value(TextInput25.Text),
        tax: Dropdown1.Selected.Value,
        currency: Dropdown3.Selected.Value,
        ShowSaveButton: false
    }
);
If(
    EditPressed,
    false,
    Collect(
        colApp,
        {
            invoiceno: "",
            invoicedate: Blank(),
            invoiceamount: 0,
            paymentref: "",
            paymentdate: Blank(),
            paymentamount: 0,
            days: 0,
            percentsales: 0,
            amountsales: 0,
            tax: "6",
            currency: "AUD",
            ShowSaveButton: true
        }
    )
);

 

 

Final patch onSuccess form:

 

If(
   CountRows(colApp) > 0,
   ForAll(
      colApp,
      If(
         !IsBlank(invoiceno),
         Patch(
            sinc_main_payment,
            Defaults(sinc_main_payment),
            {
               Title: Form1.LastSubmit.ID,
               app_no: Form1.LastSubmit.Title,
               invoice_no: Upper(invoiceno),
               invoice_date: DateValue(invoicedate),
               invoice_amount: invoiceamount,
               payment_ref: Upper(paymentref),
               payment_date: DateValue(paymentdate),
               payment_amount: paymentamount,
               days: days,
               percent_sales: percentsales,
               tax: Dropdown1.Selected,
               currency: Dropdown3.Selected,
               amount_sales: amountsales
            }
         )
      )
   )
);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @twister ,

 

Do you want to save the value of the tax column and the value of the currency column in the collection to the list?

If ,so please try this formula:

If(
    CountRows(colApp) > 0,
    ForAll(
        colApp,
        If(
            !IsBlank(invoiceno),
            Patch(
                sinc_main_payment,
                Defaults(sinc_main_payment),
                {
                    Title: Form1.LastSubmit.ID,
                    app_no: Form1.LastSubmit.Title,
                    invoice_no: Upper(invoiceno),
                    invoice_date: DateValue(invoicedate),
                    invoice_amount: invoiceamount,
                    payment_ref: Upper(paymentref),
                    payment_date: DateValue(paymentdate),
                    payment_amount: paymentamount,
                    days: days,
                    percent_sales: percentsales,
                    tax: {Value: tax},
                    currency: {Value: currency},
                    amount_sales: amountsales
                }
            )
        )
    )
);
Clear(colApp);

Refresh(sinc_main_payment);

Set(
    varLoad,
    false
);
Notify(
    "Success",
    NotificationType.Success
);
Navigate(SuccessPage);

 

Besides, I still don’t know where your dropdown1 and dropdown3 are? Are they in the gallery or in the form or in the screen?

 

Best Regards,
Wearsky

View solution in original post

19 REPLIES 19
v-xiaochen-msft
Community Support
Community Support

Hi @twister ,

 

The value of the Choice column is a record. The record has only one column. The column name is 'Value'.

So you could try this: 

tax: {Value:Dropdown1.Selected.Value} 

instead of 

tax: Dropdown1.Selected

 

and use 

currency: {Value:Dropdown3.Selected.Value}

instead of 

currency: Dropdown3.Selected

 

In addition , If it still doesn't work, please provide the formula of two dropdown controls' Items property.

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

v-xiaochen-msft
Community Support
Community Support

Hi @twister ,

 

Are your two dropdown controls in your form/datacard?

 

If so, this may be because after you use the submitform function, the value of the dropdown control is automatically cleared, causing you to use the patch function to provide a null value.

 

So, you could create 2 variables to save the value of your 2 dropdown controls.

 

Please try this formula when you use SubmitForm() function:

Set(Thevar1,Dropdown1.Selected);Set(Thevar2,Dropdown3.Selected);SubmitForm(your form)

 

If(
   CountRows(colApp) > 0,
   ForAll(
      colApp,
      If(
         !IsBlank(invoiceno),
         Patch(
            sinc_main_payment,
            Defaults(sinc_main_payment),
            {
               Title: Form1.LastSubmit.ID,
               app_no: Form1.LastSubmit.Title,
               invoice_no: Upper(invoiceno),
               invoice_date: DateValue(invoicedate),
               invoice_amount: invoiceamount,
               payment_ref: Upper(paymentref),
               payment_date: DateValue(paymentdate),
               payment_amount: paymentamount,
               days: days,
               percent_sales: percentsales,
               tax: Thevar1,
               currency: Thevar3,
               amount_sales: amountsales
            }
         )
      )
   )
);

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

twister
Post Patron
Post Patron

yes.. my form have 1 combobox(multiple selection).. I have try both of your suggestion formula seems not worked to me.. its same..tax & currency not save in sharepoint list

 

twister_0-1618557290984.png

 

Tax items property:

twister_1-1618557447752.png

 

Curreny items property:

twister_2-1618557483826.png

 

v-xiaochen-msft
Community Support
Community Support

Hi @twister ,

 

Please provide the following formula:

1\ the formula of two dropdown controls' Items property

2\ The complete formula using the submitform function

3\ Formula of onsuccess property

 

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

twister
Post Patron
Post Patron

Tax items property:

twister_0-1618557630131.png

 

 

Curreny items property:

twister_1-1618557630027.png

 

Submit button:

twister_2-1618557767808.png

 

OnSuccess:

If(
    CountRows(colApp) > 0,
    ForAll(
        colApp,
        If(
            !IsBlank(invoiceno),
            Patch(
                sinc_main_payment,
                Defaults(sinc_main_payment),
                {
                    Title: Form1.LastSubmit.ID,
                    app_no: Form1.LastSubmit.Title,
                    invoice_no: Upper(invoiceno),
                    invoice_date: DateValue(invoicedate),
                    invoice_amount: invoiceamount,
                    payment_ref: Upper(paymentref),
                    payment_date: DateValue(paymentdate),
                    payment_amount: paymentamount,
                    days: days,
                    percent_sales: percentsales,
                    tax: {Value: Dropdown1.Selected.Value},
                    currency: {Value: Dropdown3.Selected.Value},
                    amount_sales: amountsales
                }
            )
        )
    )
);
Clear(colApp);

Refresh(sinc_main_payment);

Set(
    varLoad,
    false
);
Notify(
    "Success",
    NotificationType.Success
);
Navigate(SuccessPage);
v-xiaochen-msft
Community Support
Community Support

Hi @twister ,

 

Have you tried this?

1\ use this formula on Submit button:

Set(Thevar1,Dropdown1.Selected.Value);Set(Thevar2,Dropdown3.Selected.Value);SubmitForm(Form1);Set(varLoad,true)

 

2\ OnSuccess:

 

If(
    CountRows(colApp) > 0,
    ForAll(
        colApp,
        If(
            !IsBlank(invoiceno),
            Patch(
                sinc_main_payment,
                Defaults(sinc_main_payment),
                {
                    Title: Form1.LastSubmit.ID,
                    app_no: Form1.LastSubmit.Title,
                    invoice_no: Upper(invoiceno),
                    invoice_date: DateValue(invoicedate),
                    invoice_amount: invoiceamount,
                    payment_ref: Upper(paymentref),
                    payment_date: DateValue(paymentdate),
                    payment_amount: paymentamount,
                    days: days,
                    percent_sales: percentsales,
                    tax: {Value: Thevar1},
                    currency: {Value: Thevar2},
                    amount_sales: amountsales
                }
            )
        )
    )
);
Clear(colApp);

Refresh(sinc_main_payment);

Set(
    varLoad,
    false
);
Notify(
    "Success",
    NotificationType.Success
);
Navigate(SuccessPage);
twister
Post Patron
Post Patron

Got error when im using function value

twister_0-1618559088514.png

 

If no value

twister_1-1618559104925.png

 

v-xiaochen-msft
Community Support
Community Support

Hi @twister ,

 

What's the error message?

 

Best Regards,
Wearsky

twister
Post Patron
Post Patron

This error I guess..

 

twister_2-1618559392816.png

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (46,313)