• Index
  •  » Talend Enterprise Data Integration » General questions
  •  » Use Context with Directory Field in UI

#1 2010-12-23 11:00:51

siddhartha.vinculum
New member
Registered: 2010-12-23
Posts: 1

Use Context with Directory Field in UI

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

#2 2010-12-28 02:50:36

shong
Talend team
Registered: 2007-08-29
Posts: 10289
Website

Re: Use Context with Directory Field in UI

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


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#3 2011-01-04 15:48:15

spunkypilot
New member
Registered: 2010-11-12
Posts: 3

Re: Use Context with Directory Field in UI

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

#4 2011-01-10 09:36:53

shong
Talend team
Registered: 2007-08-29
Posts: 10289
Website

Re: Use Context with Directory Field in UI

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


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

  • Index
  •  » Talend Enterprise Data Integration » General questions
  •  » Use Context with Directory Field in UI

Board footer

Powered by FluxBB