cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JamesM
Helper V
Helper V

Formatting/manipulation on series data or labels on Chart that results from custom connector JSON

I have a bar chart as below, that is fed from a collection obtained as a JSON array from a Custom Connector. The series labels along the bottom are DateTime values from the data, however the time portion is cut off. The date part is probably not relevent anyway, so is there a way to update this (without changing the custom connector) so that the series label just shows the time portion? And as another example of formatting/manipulation, what if i wanted to round the values for each bar to less decimal places? 

 

CHARTWindow.png

5 REPLIES 5
JamesM
Helper V
Helper V

I tried this, to remove the date part of the datetime value, but it didn't work, it just converts the date to a 'funny' date, e.g. 1970s.

 

ClearCollect(selectedServerAvgBasketSizeData, InSiteConnector.GetStoreCurrentBasketSize({server:selectedServer, ordercol:"RowInsertDateTime",order:"DESC",rowlimit:336})) ; UpdateIf(selectedServerAvgBasketSizeData, true, {RowInsertDateTime:TimeValue(Text(RowInsertDateTime))})

 

Another attempt, again it didn't work - the series labels are now just blank..

 

UpdateIf(selectedServerAvgBasketSizeData, true, {RowInsertDateTime:(TimeValue(Text(RowInsertDateTime,"[$-en-US]hh:mm:")))})

What I was trying to do

 

- For the whole RowInsertDateTime column (a DateTime value) convert it to text in the format of hh:mm, then convert it back to a Time value so that it will be suitable for the column.

I can do the formatting on a single record no problems;

 

TimeValue(Text(First(selectedServerAvgBasketSizeData).RowInsertDateTime))

However, that same formula does not work using isUpdate on the collection column. Any ideas?

 

v-xida-msft
Community Support
Community Support

Hi @JamesM,

Could you please share more details about the selectedServerAvgBasketSizeData collection within your app?

Where do you put the UpdateIf function?

Based on the formula you provided, I have made a test on my side, and the function works well. The screenshto as below:6.JPG

 

7.JPGPlease take a try to type the following formula within the OnVisible property or OnStart property of the first screen of your app:

 

ClearCollect(selectedServerAvgBasketSizeData, InSiteConnector.GetStoreCurrentBasketSize({server:selectedServer, ordercol:"RowInsertDateTime",order:"DESC",rowlimit:336}));
UpdateIf(
selectedServerAvgBasketSizeData,
true,
{
RowInsertDateTime: TimeValue(Text(RowInsertDateTime,"[$-en-US]hh:mm"))
}
)

If the issue still exists, please take a try with the following formual within the OnVisible property or OnStart property of the first screen of your app:

ClearCollect(selectedServerAvgBasketSizeData, InSiteConnector.GetStoreCurrentBasketSize({server:selectedServer, ordercol:"RowInsertDateTime",order:"DESC",rowlimit:336}));
ForAll(
RenameColumns(selectedServerAvgBasketSizeData,"RowInsertDateTime","RowInsertDateTime1"),
Patch(
selectedServerAvgBasketSizeData,
LookUp(selectedServerAvgBasketSizeData,RowInsertDateTime=RowInsertDateTime1),
{
RowInsertDateTime:TimeValue(Text(RowInsertDateTime1,"[$-en-US]hh:mm"))
}
)
)

then check if the issue is solved.

 

Best regards,

Kris

 

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

Thank you. Here is an example of the data stored in the AvgBasketSize variable 

 

 

[
    {
        "ServerName": "P641S001",
        "RowInsertDateTime": "2018-10-10T14:41:41.037",
        "Date": "2018-10-10T00:00:00",
        "AvgBasketAmount": 22.1424,
        "AvgBasketQty": 2
    },
    {
        "ServerName": "P641S001",
        "RowInsertDateTime": "2018-10-10T14:11:35.273",
        "Date": "2018-10-10T00:00:00",
        "AvgBasketAmount": 22.7546,
        "AvgBasketQty": 2
    }
]

I will test your suggestions and let you know 🙂 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,884)