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

Difference between context.parameters.abc.formatted & context.parameters.abc.raw

Hello All,

I am building a PCF Component where I am updating the value of the variable in the UpdateView method using the following code,

 

this.varabc = context.parameters.abc.raw

 

In many places, I have seen people also use ".formatted" in the place of ".raw" while updating their variables. I don't know the use of ".formatted" till now. 

 

Can anyone please help me know when to use ".formatted" and ".raw"? What is the difference between them?

 

Also, which one is better to use in updating the values of the variables in the UpdateView method? 

 

Awaiting your response.

 

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
DianaBirkelbach
Super User
Super User

Hi @optimisticdipak , 

 

The .raw is the actual value. The formatted is the way the data should be shown to the user. It depends what type of property you have.
For instance, when you have a number: let's suppose you have the .raw = 1000, the formatted value could be "1,000.00" or "1.000,00" or "1,000" or something else, depending on the user and column settings. 

Every data type has another rules to follow. It's a great help that you don't have to convert the data to the string which should be shown to the user. Some data types like datetime or choice or lookups could be a real pain.

 

In updateView you don't change the values. You only read them there.

In order to change the data, you call "notifyOutputChanges()", which will call the getValues where you can pass the changed data back to the runtime. The getValues is not a synchornous process: you just rely the that platform will call it a little later (asynchronous).

 

Hope this helps!

 

Kind regards,
Diana
----------
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."

View solution in original post

1 REPLY 1
DianaBirkelbach
Super User
Super User

Hi @optimisticdipak , 

 

The .raw is the actual value. The formatted is the way the data should be shown to the user. It depends what type of property you have.
For instance, when you have a number: let's suppose you have the .raw = 1000, the formatted value could be "1,000.00" or "1.000,00" or "1,000" or something else, depending on the user and column settings. 

Every data type has another rules to follow. It's a great help that you don't have to convert the data to the string which should be shown to the user. Some data types like datetime or choice or lookups could be a real pain.

 

In updateView you don't change the values. You only read them there.

In order to change the data, you call "notifyOutputChanges()", which will call the getValues where you can pass the changed data back to the runtime. The getValues is not a synchornous process: you just rely the that platform will call it a little later (asynchronous).

 

Hope this helps!

 

Kind regards,
Diana
----------
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."

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,612)