
Announcements
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.
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!