I am building a pcf dataset control specifically targeting canvas app deployment. The control needs to be flexible to lots of different views, so it needs to be able to handle any data types being thrown at it. The issue is that when I actually go to test this in a canvas app, every single column comes through as SingleLine.Text, regardless of what was actually inserted:
Take a look at the debugger screenshot above. We have a few random columns; some are optionsets (statuscode) others are DateOnly (pcx_due) but everyone of them shows up as SingleLine.Text, both in the context.parameters.dataset.columns object and in the dataset.records[x] object.
OK, so you might think I am crazy here. Maybe I just didn't pay attention to my deployment and grabbed bad data - not so:
The Canvas App itself recognizes the data types we're looking at, and lists them as DateTime and "Complex" but for some reason when the data hits the PCF, everything is a String.
OK, so at this point I thought, "maybe this is a manifest thing. I am not specifying the columns in the dataset there to keep it open for whatever view comes in, but maybe I actually need to, so I added a row for pcx_due:
<data-set name="dataSet" display-name-key="Dataset_Display_Key"> <property-set name="pcx_due" display-name-key="Due Date" description-key="Due Date" of-type="DateAndTime.DateOnly" required="true"/> </data-set>
But this had zero impact whatsoever; the datatypes are unchanged and as far as I can tell, adding this to the manifest resulted in no change to the pcf execution context whatsoever.
In most cases, I don't really care. Optionsets, for example I only want to work with labels anyway so the String representation is fine by me. but the Date one is really a headache. Because I am only getting the integer representation of the date and the object is called a String regardless of its reality, it isn't really possible for me to tell the difference between a date and an integer, so I don't know how to render the value in UI.
I assume I just skipped something in the manifest or canvas app setup, but I just don't see it. Can someone point to what I missed here?
I have the same issue. I work with optionsets, and all my columns have the datatype SingleLine.Text.
In the dataset I can see that the data is correct (for instance orb_optionsetcode in the screen below):
But both getValue and getFormattedValue are returning the string
So I suppose I'll wait until the dataset is becomming more stable in CanvasApps.
Besides that, I don't know how to define the property-sets for my dataset in the CanvasApp designer. I don't mean the definition of columns, but how to specify which one is the property-set defined in my manifest. Have you succeeded to define that?
Well, I'm glad I'm not alone on this one at least 🙂
@HemantG - is your team aware of this universal setting of all data types as String from canvas app? Should we report a 🐛?
@DianaBirkelbach No, I haven't gotten the property-set in the manifest to do anything useful so far. In the Sandbox, it forces me to try to translate columns in my csv to the defined property-set which is the behavior I would expect (some kind of forced mapping in the Canvas App setup UI) but when I actually deploy it to Canvas App it is the "Add Fields" that wins every time, without any regard to what I put in property-set... but to be honest, even though it isn't what I would have expected, that is the behavior I want: if I have to define it in advance in the Property-Set, then I have to lock into a specific set of columns; number of col and type of col. That would rob the PCF of a lot of flexibility, so honestly I am much happier with the Add Fields in canvas app winning out here.
Here, just one more screenshot that shows the weirdness: We can see here that the data is coming through the way it should, but because the Types are all wrong, this can cause us real problems when trying to render the data. For now, I guess I will just implement an ugly work-around like treating Integers greater than 1M as DateTime and less than 1M as Integers, but for obvious reasons that is not a production-quality solution.
I think in CanvasApps, "Add fields" is the way you define the "view", but each "property-set" defined in the manifest is exposed as a dedicated property for the PCF in CanvasApps.
The property-set are added as columns to the dataset (on top of the added view-columns) but for now they are all empty in CanvasApps, since I don't know how to bind them.
I understand, the property-set is not the solution for everything; but it's usefull when you want to let the user to choose fields for a specific functionality implemented.
I'm looking forward until datasets will get production-ready in CanvasApps.
Join us for the next call on August 17, 2022 at 8am PDT.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.