getDataValue, state and child component devices

I’m looking to set data values in my child apps that will not be displayed as a tile/state.

a) is it really true that childDevice.updateDataValue(“variable”, value) can only take value as a String object? Whenever I try to do something like childDevice.updateDataValue("index", 5) I get an error to the effect of no method available for type string, type integer.

b) In leiu of casting my values to String and back to Integer, I thought I would try using the childDevice state. I was also surprised to find that childDevice.state.index=5 would not work. (There is no error returned; rather the value is never set.) What I did get working is:

//parent device
childDevice.setState("index", 5)

//child device
def setState (_variable, _value){
  state."$_variable" = _value

My initial thought was that I would need a matching getter (eg getState) function, but was again surprised to find that

//parent device
log.debug "child index state value is ${childDevice.state?.index}" // logs "child index state value is 5"

//and also
log.debug "all child states are ${childDevice.state}" // logs "all child states are [index:5]"

Is my understanding of these two items correct?
a) updateDataValue can only take strings?
b) I can’t set a childDevice’s state from the parent, but I can access it?

Both of these seem rather odd, so thank you for validating or correcting my assumptions with the ST platform.

I haven’t done the testing as I’m not by my pc, but if the parent can’t see it direct, you should always be able to create a function in the child which does the setting, and then call that function from the parent. It’s easier to test that way and confirm if it it’s the parent problem.

Are your data values tiles which have information stored in them?

Thanks @cjcharles. I did end up creating the function in the child to set the values. This particular data doesn’t ever go into the tiles; it is just for getting the proper state (meta) information that then retrieves the data that does go into the tiles.