question

entelicon avatar image
entelicon asked

Keys Data Question

I'm using CloudScript GetUserInternalData, and for the keys it needs to be with a dynamic variable. I had a post on this awhile back and you told me it reads it as literals, and how to fix it. However, the keys doesnt seem to want to take the values.

var dataPayload = {};
    dataPayload[selectionOne];
    dataPayload[selectionTwo];

    
    server.GetUserInternalData({
        PlayFabId : currentPlayerId,
        Keys : dataPayload
    })

It doesnt like that ^, would it be fine with me to just set it directly in the keys slot, or would it still read it as a literal? If so, how do I fix this?

CloudScript
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

·
brendan avatar image
brendan answered

The other post was referring to writing data, not reading it. The issue above is that the dataPayload is being defined as:

{ selectionOne: null, selectionTwo: null}

Where you actually want to just pass in an array of keys to retrieve. To do so, you don't have to do anything fancy - this would work fine:

    server.GetUserInternalData({
        PlayFabId : currentPlayerId,
        Keys : [selectionOne, selectionTwo]
    })
10 |1200

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

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.