cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SAC: How to enter multiple spaces or invisible characters in ListBox items?

Steve_Letza
Explorer
0 Kudos
246

Hi, 

This is a question on SAP Analytics Cloud scripting.

I would like to be able to enter either a number of spaces into a ListBox item, or perhaps some other non-visible character. The reason for this is that I want to be able to create entries that essentially, look blank. An issue is that they need to be unique. 

A part example of some of my current code would be:

if (diff >0)
{
console.log("diff is greater than zero");
list_Box_Positive_Variances.addItem("+"+diff.toString().substr(0,5));
list_Box_Negative_Variances.addItem(".").repeat(i);
}

This is part of a FOR loop (that increments i ) and it puts a full stop in a listbox item for as many iterations of i that we are. So, for 1 to 5 iterations, it looks like this:

.

..

...

....

.....

This is fine, it works because each entry into the list box is unique. However, I can see it and I would rather enter something that is different, but not visible.

What I cannot do is replace the full stops with " ". Which is a standard space. If I enter a space character in there, nothing is shown. This means entries are not unique. The code does not error, it just does not enter unique items in the list.

As well as standard spaces, I have attempted to try entering other non-visible characters such as:

Em Space

Nonbreaking Space

No-Width Optional Break

Tab

They do not work either. 

I have also attempted to do this:

list_Box_Negative_Variances.addItem(".                 .").repeat(i);

but the spaces between the full stops just dissappear. 

 

Is there any way for me to put a special character in there and repeat it so to create unique rows of 'invisible' text? 

 

 

Kind Regards,

Steve

P.S. apologies I have posted to the wrong location. There did not appear to be an appropriate one for what I'm doing.

Accepted Solutions (0)

Answers (0)