Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
eduardo_dimperio
Specialist II
Specialist II

Transform ScriptErrorDetails Into a usable Text

Hi,

I'm trying to transform ScriptErrorDetails  in a String to Insert into a csv file.

This variable has a single quote in the middle of a message, so if a Purge them I can't transform in a string and if I don't I can't transforme either.

Input from ScriptErrorDetails variable: 'Field 'CPF\CNPJ'not found'

Code:

Let vError= PurgeChar(($(#ScriptError)&';'&ScriptErrorDetails), chr(39));
Let vError_code= SubField(vError,';',1);
Let vDetail= Text(SubField(vError,';',2));
Let MyMessage =$(vDetail);  //  Field CPF\CNPJ not found

Error: UnexpectedToken CPF/CNPJ

Any idea how to transform all this in a string?

Thank you

Labels (1)
1 Solution

Accepted Solutions
eduardo_dimperio
Specialist II
Specialist II
Author

Hi,

I solved purgin the single and double quote and after adding a double quote.

 

Let vError=($(#ScriptError)&';'&ScriptErrorDetails);
Let vError_code= SubField(vError,';',1);
Let vDetail= chr(34)&PurgeChar('$(vError)',chr(39)&123456789&';'&chr(34))&chr(34);

View solution in original post

3 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I believe you need to quote ScriptErrorDetails

'$(ScriptErrorDetails)'

So

'$(#ScriptError)'&';'&'$(ScriptErrorDetails)' as Error

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

eduardo_dimperio
Specialist II
Specialist II
Author

Hi Rob,

The Output of a ScriptErrorDetails i need to put into a variable and not a field, so I can't use as Error, but i tried to put this result into a variable and the error persist.

Let vError= '$(#ScriptError)'&';'&'$(ScriptErrorDetails)';

 

image.png

eduardo_dimperio
Specialist II
Specialist II
Author

Hi,

I solved purgin the single and double quote and after adding a double quote.

 

Let vError=($(#ScriptError)&';'&ScriptErrorDetails);
Let vError_code= SubField(vError,';',1);
Let vDetail= chr(34)&PurgeChar('$(vError)',chr(39)&123456789&';'&chr(34))&chr(34);