cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Patch is dropping trailing zeroes in a Collection

In my Power App I have a section where users can add multiple line items and the Save Button Patches the data for each line.

When a user enters say 125.20 and then clicks the Save button, the Field value drops to 125.2

This causes an issue as I have another field where users enter the Total amount of all items they are submitting.
So in the "Total Amount" they enter 125.20, but the Field value in the table after patch is now 125.2 and the two values don't match.

ETA Collection information for the OnStart of my App:
ClearCollect(AcctInfo, {CompanyCode:"", GenLedAcct:"", ProCenter:"", CostCenter:"", WBS:"", IntOrder:"", Amount:"", TaxAllCode:"", TaxJurCode:"", Desc:"", TradPart:"", ShowSaveButtons: true })

 

Tried using Amount: 0 but received errors in the clearcollect statement.

 

My Patch command is: 
Patch(AcctInfo,ThisItem,{CompanyCode:CompanyCodeVal.Selected.Result,GenLedAcct:GenLedAcctVal.Text,ProCenter:ProCenterVal.Text,CostCenter:CostCenterVal.Text,WBS:WBSVal.Text,IntOrder:IntOrderVal.Text,Amount:Value(AmountVal.Text),TaxAllCode:TaxAllCodeVal.Selected.Result,TaxJurCode:TaxJurCodeVal.Text,Desc:DescVal.Text,TradPart:TradPartVal.Text,ShowSaveButtons: false });

Where "AmountVal" is a Text Input field - Format = TextFormat.Number

8 REPLIES 8
eka24
Super User
Super User

What is your datasource, excel?

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Anonymous
Not applicable

It is Patching the data to a secondary SharePoint list.
The column there is "Currency".
It only drops trailing zeroes after a decimal point. if they enter .35 it works.. if they enter 123,123 everything is good..

But enter 123.30 and get 123.3

I've tried setting it to Decimal point zero and Decimal point 2 .. both result in the same dropping of the trailing zero. 

Consider using a Single line of text Column

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Anonymous
Not applicable

@eka24  Thanks.. I tried Number field, Text field and currency with no change..

But I forgot to mention something that might be where the issue is.

 

My patch command is updating a Collection in the form, not the actual SharePoint list. My Submit button then writes the collection to the 2nd list.

The part of the "OnStart" for my app that builds the Collection:

ClearCollect( AcctInfo, {CompanyCode:"", GenLedAcct:"", ProCenter:"", CostCenter:"", WBS:"", IntOrder:"", Amount:"", TaxAllCode:"", TaxJurCode:"", Desc:"", TradPart:"", ShowSaveButtons: true })

 

I tried using Amount: 0 but get errors.
Not sure if Amount in the collection needs to be a number/value column, and if so, how to set it that way OnStart?

In your collection, do you have the trailing zero?
gg.PNG

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Anonymous
Not applicable

No trailing zeroes in the collection, nor the field once I click the button that runs the Patch command.

Enter amount:

samntpatchbut.png

after pressing the Save Button which runs the Patch command:

amntpatchbut2.png

Collection shows .2 rather then .20:

amntcol.png 

Anonymous
Not applicable

After trying multiple work arounds ( Setting Account to Amount: Blank(), Forcing #.## in the text input field, etc.) and still losing the trailing zeroes I have opened an incident with Microsoft to see if they have a resolution. 

Something else to note..

 

As I mentioned, the user can add multiple items to the "Repeating Table" ( following the steps from Shane Young ) and when summing up the Amount in the collection ( Sum( AcctInfo, Amount) ), it also loses the trailing zeroes.

So if they enter 100.18 on one line, and 100.02 on a 2nd line, then the sum comes back as 200.2

 

In the SharePoint list the items are not losing the zeroes.. so it seems to be a "Display issue" in the App and not a value issue:

shanemeisner_0-1620301950161.png

 

Anonymous
Not applicable

Two days later.. No resolution yet from Microsoft.

So, I created a copy of my App and since for whatever reason I Can't change Amount: "" to Amount: 0 , I removed Amount and added "LineAmount: 0" :

 

If(IsBlank(ListItemID),ClearCollect(AcctInfo,{CompanyCode:"", GenLedAcct:"", ProCenter:"", CostCenter:"", WBS:"", IntOrder:"", LineAmount: 0, TaxAllCode:"", TaxJurCode:"", Desc:"", TradPart:"", ShowSaveButtons: true }),//if a new item then create empty collection// 

 

Then in my Amountval field I added this formula for the Default: Text( ThisItem.LineAmount, "#.00")

and now the Amount entered in that field keeps the trailing zero after clicking the "Save Row" button":

shanemeisner_0-1620392537165.png

Unfortunately when I save that row, the Patch: LineAmount( LineAmount: Value(AmountVal.Text))
is still dropping the trailing zero:

shanemeisner_1-1620392592035.png

I've tried multiple ways to try and force the Patch to include the trailing zeroes including this:

LineAmount: Value(Text( ThisItem.LineAmount, "[$-en-US]#.00"))

There are no errors, but it still drops the trailing zero. 

I feel I am this close to figuring this out, but the Patch command is kicking my butt..

Any ideas??

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,256)