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

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (76,838)