cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Reformat column in collection contains value variables.

I have a column that has currency values.

 

There is a 'price' column in the collection and the values are in the format as 1234.33 and 13583.22 etc. I wan to reformat them as $1,234.33 and $13,583.22

 

I am aware of the formula Text( 1200000.00, "[$-en-US]$ #,###.00" ).

 

How do I apply this formula to whole column in the collection?

3 REPLIES 3
Highlighted
Super User
Super User

Re: Reformat column in collection contains value variables.

@IAmTheAppUser 

Well, there are a few ways we could tackle this.  From your problem statement I assume you need the formatted number column to appear in the price column and the original number type data should be deleted.  In that case use the code below.

 

ClearCollect(your_collection_name,
    RenameColumns(
        DropColumns(
            AddColumns(
                your_datasource_name,
                "priceFormatted",
                Text(price,"[$-en-US]$#,###.##")
            ),
        "price"),
    "priceFormatted",
    "price")
)

 

If you just want to add a column with the formatted text don't bother with the DROPCOLUMNS and RENAMECOLUMNS functions in my solution.  Finally, make sure you use this code when the collection is first created.  A column within a collection must have the same data type throughout the app.  It cannot have number types in one place and text in another.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Frequent Visitor

Re: Reformat column in collection contains value variables.

For some reason, the formula did not work.

 

It basically copy the same value again (I tested it with adding the value to another column).... That's the main reason that I encountered.

 

The formula works: Text( 1200000.00, "[$-en-US]$ #,###.00" ) - if we specify the number in the formula. The formula seems not able to adjust the number in the collection. The only thing I am able to do is to add a '$' symbol before the figure. Not adjust anything in between the number. Do you have any idea how to get pass this issue?

Highlighted
Community Support
Community Support

Re: Reformat column in collection contains value variables.

Hi @IAmTheAppUser ,

 

Check on below thread to see if it could help:

https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Format-values-from-Collection-Table...

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
secondImage

New Return to Workplace

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

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response 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,065)