cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
cjs321
Level: Powered On

Powerapps Pen Input - Patch to multiple records in a gallery

Hi,

 

I need help with powerapps gallery's and Pen Input controls (And forms).

 

So, i've created a simple expenses app, which allows users to record expenses and then claim them at a later date...

 

I have a claim screen, where it gives them a date period filter, and a 2 buttons. 1 above the gallery 'Sign ALL expenses' and 1 on the gallery itself 'Sign Expense' so the user can sign individual expenses.

 

That feature works fine, however, i can't seem to get the 'Sign ALL expenses' function to work (don't know where to start with it).

 

For the 'Sign Expense' button (for individual expenses), it opens an Edit form, gives the users a pen input and a submit button. That, updates the record with the signature.

 

How can i add the functionality, where you can sign, and apply it to all Filtered  expenses?

 

Please help 😞

 

Attached is a screenshot of my app.

 

Kind Regards,

 

Connor Simpson

10 REPLIES 10
v-siky-msft
Level 10

Re: Powerapps Pen Input - Patch to multiple records in a gallery

Hi @cjs321 ,

 

Do you want to patch a signature to all selected items when choosing 'Sign ALL expenses'?

Which data source of your app?

ForAll function would be a good choice to work with this situation if you want to patch all gallery items at one time.

you can try with the following formula to OnSelect property of Submit button:

ClearCollect(NewData, RenameColumns(ShowColumns(Gallery1.AllItems,"UniqueColumnName"),"UniqueColumnName","AL"));
ForAll(NewData,Patch(Contacts,LookUp(Contacts,'UniqueColumnName'=AL),{'ImageColumnName':PenInput1.Image}))

UniqueColumnName can be the primary field which is unique. ImageColumnName is the column to save your signature.

Please have a try, If I have any misunderstandings, please post back.

Best regards,

Sik

 

 

cjs321
Level: Powered On

Re: Powerapps Pen Input - Patch to multiple records in a gallery

Hi @v-siky-msft ,

 

Yeah, i'd like to record / patch a signature when the 'Sign ALL Expenses' button is pressed.

 

Please see attached image for datasources. You'll notice there is a source called 'SignaturesTable', this is not in use, it was created in case, the signatures need to go to another sheet, in order for the patch function to patch it back to "ExpenseDetailsTable".

 

When the 'Sign ALL Expenses' button is pressed, it takes the user to a new screen with a Form, and a PenInput control. What i thought about doing, was to link the form to the 'SignaturesTable' and then have it patch the signature back to the 'ExpenseDetailsTable', using the syntax you have provided me with.

 

I'm a little confused as to how your syntax would be reworded to work in my app.

 

Please can you help me?

 

The 'ExpenseDetailsTable' is where all of the information records back to, this is where i need the signature to end up.

 

Each Expense, has an EmployeeName and TripPeriod assigned to it, meaning that these columns can be used to filter the table.

 

The column where the signature needs to end up, is 'EmployeeSignature[image]'.

 

Thankyou 🙂

 

Kind Regards,

 

Connor Simpson

v-siky-msft
Level 10

Re: Powerapps Pen Input - Patch to multiple records in a gallery

HI @cjs321 ,

 

A little confusion I want to confirm:

1. Do you mean the signatures fistly save to 'SignaturesTable', and then patch back to  'EmployeeSignature[image]' column of "ExpenseDetailsTable"?

2. Can it be patched to "ExpenseDetailsTable" directly?

3. The data source of gallery is "ExpenseDetailsTable", right?

4. What does the form use for? Is the Peninput box in the form or out of ?

ClearCollect(NewData, RenameColumns(ShowColumns(Gallery1.AllItems,"UniqueColumnName"),"UniqueColumnName","NewColumnName"));
ForAll(NewData,Patch(ExpenseDetailsTable,LookUp(ExpenseDetailsTable,UniqueColumnName=NewColumnName),{EmployeeSignature: PenInput1.Image}))

The first ClearCollect function is to collect all items of gallery to "NewData" collection, i also shape it to only leave the unique column and change the column to "NewColumnName" to avoid ambiguity.

In second ForAll function, it will traverse each item, and Patch function would be executed once for each item. In Patch function, it is to look up the record corresponding to the item of gallery, and then patch signature to "ExpenseDetailsTable".

All you need to modify is "UniqueColumnName", you should modify it to unique column name of "ExpenseDetailsTable". Then put the formulas to Onselect property of Submit button.

 

Best regards,
Sik

cjs321
Level: Powered On

Re: Powerapps Pen Input - Patch to multiple records in a gallery

Hi @v-siky-msft ,

 

Ideally, i want the signature to save to ExpenseDetailsTable directly!

 

Yes, the datasource is set to ExpenseDetailsGallery - Which is filtered by DatePeriod=dropdown5_5.selected.Result&EmployeeName=User().FullName

 

The Form doesn't need to be there and neither does the SignaturesTable. But the captured signature will need to be saved in Onedrive, can this be done without a form?!

 

Thanks Sik 🙂

 

Kind Regards,

 

Connor Simpson

v-siky-msft
Level 10

Re: Powerapps Pen Input - Patch to multiple records in a gallery

Hi @cjs321 ,

 

Yes, you just need a peninput box and "submit" button to use patch function to save signature to table.

Please take a try and check if your issue is fixed.

Annotation 2019-09-30 181127.png

Best regard,

Sik

cjs321
Level: Powered On

Re: Powerapps Pen Input - Patch to multiple records in a gallery

Hi @v-siky-msft ,

 

It kinda worked... It saved the signature and patched it back to the table, but there are a couple of issues.

 

It has created a file per gallery record, all the same image but all with different names.

 

Can it do it so that it saves 1 image and points the signed expenses to that image?

 

Please see attached image.

 

This shows my excel sheet. It seems to be recording new lines for the expenses, rather than modifying the existing ones.

 

Kind Regards,

 

Connor Simpson

cjs321
Level: Powered On

Re: Powerapps Pen Input - Patch to multiple records in a gallery

Hi @v-siky-msft ,

 

Any update on this?

 

I can't figure this one out 😞

 

Kind Regards,

 

Connor Simpson

v-siky-msft
Level 10

Re: Powerapps Pen Input - Patch to multiple records in a gallery

Hi @cjs321 ,

 

Apologize for the delay reply.

Can you show me the formulas you modified?

What is the UniqueColumnName you choose to match the record?

 

There seems to be something wrong with the LookUp() function part in Patch() formula. Could you show me that?

If you want to patch the old record, not to create a new record, you have to use LookUp function to find out that record.

 

Best regards,

Sik

 

cjs321
Level: Powered On

Re: Powerapps Pen Input - Patch to multiple records in a gallery

Hi @v-siky-msft ,

 

No Worries 🙂

 

Please see formula:

 

ClearCollect(NewData, RenameColumns(ShowColumns(ClaimExpensesGallery.AllItems,"EmployeeName"),"EmployeeName","EmployeeName")); ForAll(NewData,Patch(ExpenseDetailsTable,LookUp(ExpenseDetailsTable,User().FullName in EmployeeName & Dropdown5_5.Selected.Result in DatePeriod),{EmployeeSignature: PenInput1.Image}));Refresh(ExpenseDetailsTable);Reset(ClaimExpensesGallery);Back()

 

Please also see Excel sheet attached.

 

Kind Regards,

 

Connor Simpson

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,194)