Empty string in attribute

workflow
#1

Hi Folks,

I have a string attribute that sometimes is updated with a blank string. In the workflow it shows as “”. I’m finding losant doesn’t update the data for this attribute, instead stays with the last value of a non-blank string. In my use case, I am displaying that string in an indicator block and when its empty I want it to show as blank as opposed to the last non-blank value. Is there an easy workaround for that?

#2

Hi Paul,

Let me know if this isn’t what your use case calls for, as there could be other workarounds available! In this case, I would include a conditional within your workflow that checks for an empty string at the payload path for the attribute. If it is empty (true), you could replace "" with undefined, a space character (_), or even empty quotation marks ("''"). You will need to update the state with this new value. If you would like to show no value in the Indicator Block when the string is empty, the space character may be your best bet. If you do set that empty string to a space character, you will be able to work with conditionals within the Indicator Block as well.

Let me know if this is not what you were thinking, and we can look again :smiley:

Thanks,
Julia

#3

that is exactly the use case I had in mind. However, I’m not clear how to represent the whitespace character when updating the state. I should be able to simulate by forcing a state from the Debug tab yes? If I hit the space bar and force state, it doesn’t update with any value. Is there a special character to represent whitespace that would translate over to the indicator block is just empty space?

#4

Hi @paul_wareham,

I was also unable to force a space character from the debug tab, but I was able to do so within a Workflow and from the Device Simulator. I simulated using the space character for one of my string values, and was able to get a state update with the “blank” string:

I also was able to report a space string with a workflow:


I will look into forcing a space character from the Debug tab further, and update you when I find a solution. :smile:

Thanks!
Julia