You are not logged in.
Announcement
Unanswered posts
|
Pages: 1
Hi,
I am creating a Directory type parameter in a custom component.But when i try to use context in that field it fails it simply takes the value that in there in the directory box ex "context.GIP_DATAFILE_LOCATION" instead of the value of the context. Is this a bug because context is working fine with text fields in the same component.
I am using talend version V4.0.3
My entry in component xml file tGipOutput_java.xml
<PARAMETER NAME="DATAFILELOCATION" FIELD="DIRECTORY" NUM_ROW="23" REQUIRED="true" REPOSITORY_VALUE="DATAFILELOCATION">
<DEFAULT>"__COMP_DEFAULT_FILE_DIR__" OR context.GIP_DATAFILE_LOCATION</DEFAULT>
</PARAMETER>
In the code
<%
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String file_path = ElementParameterParser.getValue(node,"__DATAFILELOCATION__");
%>
int nb_line_<%=cid%> = 0;
String file_path__<%=cid %> ="<%=ElementParameterParser.getValue(node,"__DATAFILELOCATION__").replaceAll("\"", "")%>";
Regards
Siddhartha
Offline
Hi
<DEFAULT>"__COMP_DEFAULT_FILE_DIR__" OR context.GIP_DATAFILE_LOCATION</DEFAULT>
It is impossible to set the context variable in the xml file, the default value should be
<DEFAULT>"__COMP_DEFAULT_FILE_DIR__"</DEFAULT>
Please refer to the directory filed on tFileList component.
Best regards
Shong
Offline
Hi Shong,
You are saying that "it is is impossible to set the context variable in the xml file". But within the same component, we have text-fields, where we use context-variables to set the values. E.g. to set an IP-Address, the relevant section in the xml-file looks like:
<PARAMETER NAME="IP" FIELD="TEXT" REQUIRED="true" NUM_ROW="88" REPOSITORY_VALUE="IP">
<DEFAULT>"Enter IP Address" OR context.GIP_IP_ADDRESS</DEFAULT>
</PARAMETER>
The above section works perfectly. So should the same approach not work for directory-fields if it does for text-fields?
Kind regards,
Rico
Offline
Hi Rico
Sorry, I made a mistake, thanks for correcting me. I test to modify the xml file of tFileList component like this and it works.
<PARAMETERS>
<PARAMETER NAME="DIRECTORY" FIELD="DIRECTORY" NUM_ROW="1">
<DEFAULT>context.filepath</DEFAULT>
</PARAMETER>
But when i try to use context in that field it fails it simply takes the value that in there in the directory box ex "context.GIP_DATAFILE_LOCATION" instead of the value of the context.
Are you sure you have removed the double quote in the javelet files? even thought I see you add this line of code
String file_path__<%=cid %> ="<%=ElementParameterParser.getValue(node,"__DATAFILELOCATION__").replaceAll("\"", "")%>";
Best regards
Shong
Offline
Pages: 1