Empty string in attribute

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?

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

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?

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

Hello. I know this is a very old post, but I just ran into the same issue: I was able to get away with [ALT] + 255 (the ascii code for a space) and it was running OK until today. For some reason on any of my workflows, I can’t process an ALT255/space anymore! :frowning: I also tried all other forms mentioned herein, didn’t work :frowning: FYI. :red_circle:

UPDATE: I was able to get a workaround by, instead of inserting an [ALT] + 255 as an individual field as the data method, I did it thru a JSON Template and, for now, it worked:
image
Hopefully this one ‘sticks’ around, :red_circle: