cancel
Showing results for 
Search instead for 
Did you mean: 

SetVariableValueExt + sign

former_member195631
Participant
0 Kudos

Hi

I have a strange error message in D.S 1.3

I'm trying to filter data in Data source with a Variable

My issue is that when I try to filter the data with a string that contains + sign, like "Demo+" for example

I get an error message "Input "Demo+" for Item has an invalid format"

Any suggestions

Shlomi

Accepted Solutions (0)

Answers (2)

Answers (2)

Karol-K
Advisor
Advisor
0 Kudos

Hello Shlomi,

the value parser is exactly same as in BEx (as it is using BICS layer). Probably "+" is pointing to hierarchy, and this is making troubles.

you can try following:

* escape this "+" with "\+"

* select the variable manually and then use the function .getVariableExt() - this should bring the correct string, just place on some text box.

* if you have BEx, what would be the input string threre?

write short response, then I try to find such scenario inhouse and double check.

shlomi_weiss2
Participant
0 Kudos

Hi Karol

Thanks for your reply, I really start to loose hope

I tried your suggestion and when I use getVariableValueExt I get the string

"Demo1\+Demo2" which is exactly what you have suggested.

The problem is that I cannot use that string within the setVariableValueExt function

APPLICATION.setVariableValueExt("psItemName", "Demo1\+Demo2");

I get some error messages

Multiple markers at this line

- Couldn't resolve reference to Variable 'Demo2'.

- mismatched character '<EOF>' expecting '"'

- mismatched character '+' expecting set null

By the way my model is over a UNX Universe and not Bex

Any suggestions?

Shlomi

Karol-K
Advisor
Advisor
0 Kudos

this looks like the "\" character is escaping the next character "+".

Please try following string (double \\)

APPLICATION.setVariableValueExt("psItemName", "Demo1\\+Demo2");


does this work?

shlomi_weiss2
Participant
0 Kudos

Hi Karol

You are awesome, it actually works

Now I have just another question

What if I want to filter with more than 1 '+' sign?

I use IndexOf in order to replace the '+' with '\\+'

I'll try and use the split option to do that.

I couldn't mark as right answer for some reason

Thanks

Shlomi

Karol-K
Advisor
Advisor
0 Kudos

the problem is not the "+" sign, but the "\" sign. As this sign is escaping the real content, you need to assure that all real "\" is escaped by another "\", so the content does always have two: "\\".

I do not have now an example with +, but this should work:

var theContent = DS_1.getVariableValueExt ("psItemName");

// return is "Demo1\+Demo2"

theContent = Convert.replaceAll(theContent, "\\", "\\\\");

// this should be now correctly replaced and escaped

Does this work this way?

TammyPowlas
Active Contributor
0 Kudos

Shlomi - is your data source HANA, universe or BW?

former_member195631
Participant
0 Kudos

UNX Universe

Shlomi

TammyPowlas
Active Contributor
0 Kudos

I don't have a good answer for you here; my guess in from reading the help http://help.sap.com/businessobject/product_guides/AAD13/en/ds13SP02_user_en.pdf is that Design Studio is reading that "+" as a hierarchy; I am not a big user of the universe so I hope others have suggestions to help here.

shlomi_weiss2
Participant
0 Kudos

Hi Tammy

Thanks for your answer.

I've checked on SP02 and it's the same

It doesn't make any sense that no one has encountered it so far.

I'm just trying to filter data with a basic function of setVariableValueExt with a string that contains '+' sign in it, it should be common issue and I couldn't find any note about it.

Shlomi

TammyPowlas
Active Contributor
0 Kudos

Hi Shlomi - if no one responds, I recommend opening a SAP incident with SAP so they can address this.