Sign In Register

How can we help you today?

Start a new topic

Null default value in events

To make an event parameter optional, I can set a default value. What if I want a string parameter to be optional, but default to null or empty string?


Hey Ben,

You can do this the same way by putting in an empty string as the value when you create the event...



Does that work?
Let me know if ive misunderstood the problem.
Thanks,
Sean

 

Hey Sean,


Looks like the image link died. How would one specify empty string in that field?


Thanks,

Ryan

Sean: Sorry, I never saw the reply until Ryan replied today.


The problem is that leaving the default value empty makes the field mandatory, so it's not clear how the field can be made optional AND take on a default value of null/empty string.

I was thinking the same thing the other day. Was thinking how nice it'd be to have a checkbox indicate whether the default field should be "null".

Hi Guys,


Once an attribute is defined in the config it will always be expected when the request is sent. You could place default values in here that will be used when specific values are not defined on the client side. Then, in your Cloud Code script check for these default values and if they are present handle them accordingly. There is no way to mark attributes as optional or null currently. If you like to see this added you can log a feature request for it here.


Thanks,

Liam

Thank you, I've filed a featured request here: https://support.gamesparks.net/support/discussions/topics/1000084505


2 people like this

Any update on when this feature is going to get implemented?

Login to post a comment