question

glen avatar image
glen asked

Is it possible to query the size of a player data KVP?

I'd like to be able to check the size of a player's KVP and have our system react accordingly. Is this possible? Might also require access to the max size per KVP as well, although we could goofy that by hardcoding a value.

Player Data
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
pfnathan avatar image
pfnathan answered

Please take a peek following forum discussion as your reference: https://community.playfab.com/questions/13766/player-data-title-data-value-size.html

5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

glen avatar image glen commented ·

I'm referring to checking the existing size of a player's KVP via code. The forum post linked doesn't cover this concept.

0 Likes 0 ·
brendan avatar image brendan glen commented ·

No, there isn't currently a query for the size of KVPs in data. If that's something you need, I'd recommend adding it to the Feature Requests forum.

0 Likes 0 ·
glen avatar image glen commented ·

Would it be possible to reliably calculate this ourselves? The approach I'm considering is taking the length of the KVP data string and multiplying it by 1 byte. In this scenario I'm assuming that we're only using ASCII characters, no unicode characters.

0 Likes 0 ·
brendan avatar image brendan glen commented ·

The value is simply a string, so if you mean calculating the total size in bytes, that should be straightforward. However, yes, due to the need to support all languages, it's not simple ASCII - the full Unicode range is supported.

0 Likes 0 ·
glen avatar image glen brendan commented ·

That'll work for my needs.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.