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

Help with Collections and SharePoint lookup field

Hi,

I am new to Collections and trying to display and save a SharePoint lookup field in Collections and then save the selected values back to SharePoint List. Similar to info-path repeating table. I watched Shane young video couple of times and able to successfully do with "Single line of Text" but to avoid user errors, I want to go the lookup route.

 

First how do I display the drop down to Point to lookup column in a SharePoint list?

 

PBala_0-1595606246269.png

 

How would then patch the selected value to the Collections?  The Collection is called "Expense Collection"? For Single line of text I use the following formula?

 

Patch(
ExpenseCollection,
ThisItem,
{
LineItem: LineItem.Text,
LineCost: Value(LineCost.Text),
LineQuantity: Value(LineQuantity.Text),
LineSize: LineSize.Text
}
);
Collect(
ExpenseCollection,
{
LineItem: "",
LineCost: 0,
LineQuantity: 0,
LineSize: ""
}
)

 

Then finally, how will I save it back to SharePoint list the value saved in Collections?

 

ForAll(
ExpenseCollection,
If(
!IsBlank(LineItem),
Patch(
'Company Store Order Form',
Defaults('Company Store Order Form'),
{
Title: LineItem,
Quantity: LineQuantity,
Price: LineCost,
Size: LineSize,
MasterID: Form1.LastSubmit.ID,
EName: Form1.LastSubmit.Title,
PhoneNumber: Form1.LastSubmit.PhoneNumber
}
)
)
)

 

Thanks for the help.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Help with Collections and SharePoint lookup field

Hi @PBala ,

 

Patch(
    ExpenseCollection,
    ThisItem,
    {
        LineItem: LineItem.Text,
        LineCost: Value(LineCost.Text),
        LineQuantity: Value(LineQuantity.Text),
        LineSize: LineSize.Text,
        ddlValue:Dropdown1.Selected.Item
    }
);
Collect(
    ExpenseCollection,
    {
        LineItem: "",
        LineCost: 0,
        LineQuantity: 0,
        LineSize: "",
        ddlValue:""
    }
)

use this to build the collection and then on saving the data back to Sharepoint use as below:

ForAll(
    ExpenseCollection,
    If(
        !IsBlank(LineItem),
        Patch(
            'Company Store Order Form',
            Defaults('Company Store Order Form'),
            {
                Title: ddlValue,
                Quantity: LineQuantity,
                Price: LineCost,
                Size: LineSize,
                MasterID: Form1.LastSubmit.ID,
                EName: Form1.LastSubmit.Title,
                PhoneNumber: Form1.LastSubmit.PhoneNumber
            }
        )
    )
)


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: Help with Collections and SharePoint lookup field

Hi @PBala,

 

I don't see any issue in your approach however what is that dropdown you highlighted in the screenshot with the error and what is the value you are associating to it?


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
Highlighted
Helper I
Helper I

Re: Help with Collections and SharePoint lookup field

hi,

How do I associate a SharePoint lookup column to display and store information in Collections and then patch the collections data to a SP List?

 

The SP list is "Company Store Order Form"

Lookup Column is "Items"

Collections is ExpenseCollection

 

PBala_0-1595616536329.png

 

Thanks

 

Highlighted
Super User III
Super User III

Re: Help with Collections and SharePoint lookup field

Hi @PBala ,

 

Patch(
    ExpenseCollection,
    ThisItem,
    {
        LineItem: LineItem.Text,
        LineCost: Value(LineCost.Text),
        LineQuantity: Value(LineQuantity.Text),
        LineSize: LineSize.Text,
        ddlValue:Dropdown1.Selected.Item
    }
);
Collect(
    ExpenseCollection,
    {
        LineItem: "",
        LineCost: 0,
        LineQuantity: 0,
        LineSize: "",
        ddlValue:""
    }
)

use this to build the collection and then on saving the data back to Sharepoint use as below:

ForAll(
    ExpenseCollection,
    If(
        !IsBlank(LineItem),
        Patch(
            'Company Store Order Form',
            Defaults('Company Store Order Form'),
            {
                Title: ddlValue,
                Quantity: LineQuantity,
                Price: LineCost,
                Size: LineSize,
                MasterID: Form1.LastSubmit.ID,
                EName: Form1.LastSubmit.Title,
                PhoneNumber: Form1.LastSubmit.PhoneNumber
            }
        )
    )
)


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
Krishna
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Come join us today! Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,553)