Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
joefrancois
Contributor III
Contributor III

Creating a component need help retrieving a string value

Hello,

 

I am in the process to create a new component. I am able to retrieve all parameters as strings except for a Parameter closed list, which gets pickup as a variable and not a string. 

 

The METHOD parameters is the only CLOSED_LIST parameter. Please see XML below.

0683p000009Lx4s.png

 

I used a standard ElementParameterParser.getValue to retrieve the set value.

0683p000009Lxgz.png

 

Here I set my string Variable with the value I just retrieved.

0683p000009LwyL.png

As you see, when I try to run it, I get a message that the system cannot resolve the POST variable, but it is not a variable but a value of the httpMethod_<%=cid%> value.

0683p000009Lxh9.png

 

When I look at the code, I can see all my other variable were set properly but for myhttpMethod_<%=cid%> variable value. The POST was set without the quotation mark. When I hard code the POST value, than the component works as expected.

 

0683p000009LxTX.png

 

Any help to resolve this would be very much appreciated. 

 

Regards,

Joseph

Labels (4)
1 Solution

Accepted Solutions
joefrancois
Contributor III
Contributor III
Author

I realized that I had to append the quotes as I was reading in the variable. Here is the line I changed that got me the result I was looking for.

 

String method = "\""+ElementParameterParser.getValue(node,"__METHOD__")+"\"";

 

Thank you for your support.

View solution in original post

2 Replies
Jesperrekuh
Specialist
Specialist

Not sure (not much experience creating components), but while generating the code, it resolves to a var name in stead of a string value, "\"POST\""  escape your quotes.

Why not use default and set it to POST 

joefrancois
Contributor III
Contributor III
Author

I realized that I had to append the quotes as I was reading in the variable. Here is the line I changed that got me the result I was looking for.

 

String method = "\""+ElementParameterParser.getValue(node,"__METHOD__")+"\"";

 

Thank you for your support.