on 03-17-2015 6:38 AM
Hi,
I have an issue in Query (Xacute or any query) results. How to replace special char like (",/,\) in results by escape char like " should be \" and \ like \\
.
Is it possible to do with XSL? I tried by using xsl but it is showing "unable to create inline transformation error".
Can you please help to solve this issue?
Thanks,
Senthil
Hi Senthil,
Let me know what are you trying to achieve by doing this replacement. Would be able to suggest something on that.
Thanks,
Swaroop
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Swaroop,
The issue is in query results if some special char like " or \ is present (like - This is \ test $",), then in JSON format result, it is showing error and we are not able to handle this output in SAP UI5. So we want to replace all these special char (",\,/) as \",\\ and \/. So i created XSL for it but while applied in inline transformation, it is showed error as "Unable to create Inline transformation".
Thanks,
Senthil
Hi Senthil,
Generally, JSON would not create any problem if the string is quoted within "". My json has data as
Plant :"Nitro\"/ Glycirides"
and the same is plotted on the UI5 ch art without any error. Please find the attachment for the same.
The problem could be from BLS or query side. Check if the result set is generated properly or not. Also, validate your JSON.
Thanks,
Swaroop
Swaroop,
Exactly as you said, the text in your json, Plant :"Nitro\"/ Glycirides" already has the double quote character escaped. Due to this, the json response is valid and hence the chart gets plot for you.
This is exactly what Sai has suggested in his reply.
If the response in the json contains a double or single quote as a part of json key OR value, then it considers it as end of string and hence becomes invalid.
@Senthil, if you are using a query which is returning bad json, then as suggested by Sai, execute the query inside a transaction's action block, then repeat over the response row wise and escape all the values where your string contains a double quote using stringreplace() function.
At the end of your iteration, the response xml will contain escaped double quotes. This output of transaction when retrieved using xacute query as text/json will give you the desired output.
Regards,
Rutika Bodas
User | Count |
---|---|
9 | |
7 | |
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.