<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic [resolved] How to Receive a Date context parameter through the shell script? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352380#M118788</link>
    <description>If I have a context parameter named "id" of type Integer, I can set it from the command line in the following manner:
&lt;BR /&gt;Test_0.1.sh --context_param id=100
&lt;BR /&gt;How would I go about passing a date through the shell script using the --context_param argument? Does Talend have a particular format string it would like to see?
&lt;BR /&gt;Using a context parameter named "dt" of type Date, I tried the following:
&lt;BR /&gt;Test_0.1.sh --context_param dt=2014-10-15
&lt;BR /&gt;But in my program I see that it is null.
&lt;BR /&gt;Regards,
&lt;BR /&gt;Matthew</description>
    <pubDate>Tue, 14 Oct 2014 04:18:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2014-10-14T04:18:08Z</dc:date>
    <item>
      <title>[resolved] How to Receive a Date context parameter through the shell script?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352380#M118788</link>
      <description>If I have a context parameter named "id" of type Integer, I can set it from the command line in the following manner:
&lt;BR /&gt;Test_0.1.sh --context_param id=100
&lt;BR /&gt;How would I go about passing a date through the shell script using the --context_param argument? Does Talend have a particular format string it would like to see?
&lt;BR /&gt;Using a context parameter named "dt" of type Date, I tried the following:
&lt;BR /&gt;Test_0.1.sh --context_param dt=2014-10-15
&lt;BR /&gt;But in my program I see that it is null.
&lt;BR /&gt;Regards,
&lt;BR /&gt;Matthew</description>
      <pubDate>Tue, 14 Oct 2014 04:18:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352380#M118788</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-14T04:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to Receive a Date context parameter through the shell script?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352381#M118789</link>
      <description>hi mmoisen, 
&lt;BR /&gt;you are not 'passing a date' to your script. 
&lt;BR /&gt;it's just a suite of caraters that will be be seen as a String in java. So if you have to manage Date type in your Talend Process, you'll have to convert string in Date before. 
&lt;BR /&gt;I often read a date as a string until I have to use Date methods to do some calculation (ex : add a date). Otherwise keep it in String. 
&lt;BR /&gt; 
&lt;PRE&gt;&lt;BR /&gt;TalendDate.parseDate("dd-MM-yyy",context.dateparam)&lt;BR /&gt;&lt;/PRE&gt; 
&lt;BR /&gt;regards 
&lt;BR /&gt;laurent</description>
      <pubDate>Tue, 14 Oct 2014 09:42:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352381#M118789</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-14T09:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to Receive a Date context parameter through the shell script?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352382#M118790</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;hi mmoisen,&lt;BR /&gt;you are not 'passing a date' to your script.&lt;BR /&gt;it's just a suite of caraters that will be be seen as a String in java. So if you have to manage Date type in your Talend Process, you'll have to convert string in Date before.&lt;BR /&gt;I often read a date as a string until I have to use Date methods to do some calculation (ex : add a date). Otherwise keep it in String.&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;TalendDate.parseDate("dd-MM-yyy",context.dateparam)&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;regards&lt;BR /&gt;laurent&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Hi Laurent, 
&lt;BR /&gt;In the case of a context variable I've defined as a Long or Integer, Talend apparently converts it for me into the correct data type. However for Date your conclusion is correct as far as I can tell-- I'll convert it into a Date before utilizing it. 
&lt;BR /&gt;Thanks, 
&lt;BR /&gt;Matthew</description>
      <pubDate>Tue, 14 Oct 2014 09:45:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352382#M118790</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-14T09:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to Receive a Date context parameter through the shell script?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352383#M118791</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;I've defined as a Long or Integer, Talend apparently converts it for me into the correct data type&lt;BR /&gt;&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;??? 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;if you have define your data as Long or Integer, you have to convert explicitly it into Date to have a Date, no ? 
&lt;BR /&gt;otherwise you'll have 
&lt;BR /&gt; 
&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;Type mismatch: cannot convert from Integer to Date&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Tue, 14 Oct 2014 09:51:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352383#M118791</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-14T09:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to Receive a Date context parameter through the shell script?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352384#M118792</link>
      <description>I mean to say, if I've defined a context variable as a Long, and I pass the value via test_1.0.sh --context_param long_id=123, Talend appears to convert it from Long to String for me.
&lt;BR /&gt;But if I've defined a context variable as a Date, it won't convert from String to Date for me.</description>
      <pubDate>Tue, 14 Oct 2014 09:54:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352384#M118792</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-14T09:54:16Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to Receive a Date context parameter through the shell script?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352385#M118793</link>
      <description>but in '--context_param long_id=123', 123 is not a String or a Long or any other java type 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MA9p.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/138034i5F552429DA646D6F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MA9p.png" alt="0683p000009MA9p.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;outside java (talend) you are not manipulating java type. 
&lt;BR /&gt;a value for a param context , coming from shell script or a config.ini will always deen as a String (java type) in your application.</description>
      <pubDate>Tue, 14 Oct 2014 10:05:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352385#M118793</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-14T10:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to Receive a Date context parameter through the shell script?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352386#M118794</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;but in '--context_param long_id=123', 123 is not a String or a Long or any other java type &lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MA9p.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/138034i5F552429DA646D6F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MA9p.png" alt="0683p000009MA9p.png" /&gt;&lt;/span&gt;&lt;BR /&gt;outside java (talend) you are not manipulating java type.&lt;BR /&gt;a value for a param context , coming from shell script or a config.ini will always deen as a String (java type) in your application.&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;Hey Kzone, 
&lt;BR /&gt;I've tried it with Long, Integer, and Boolean. Talend must be smart enough to convert it from a String to the appropriate java type. 
&lt;BR /&gt;For example, I have a job called TestCommandLineBoolean, with a context variable named "is_bool" of type Boolean 
&lt;BR /&gt; 
&lt;BR /&gt;and one tJava with the following code: 
&lt;BR /&gt; 
&lt;BR /&gt; 
&lt;PRE&gt;if (context.is_bool != null) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (context.is_bool) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println("is_bool is true");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println("is_bool is false");&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;} else if (context.is_bool == null) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println("is_bool is null");&lt;BR /&gt;} else {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.out.println("is_bool is neither!");&lt;BR /&gt;}&lt;/PRE&gt; 
&lt;BR /&gt;If I run it without passing a context parameter, is_bool defaults to false: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBFT.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/146233i74AE175B827F826B/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBFT.png" alt="0683p000009MBFT.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;If I run it passing in "true", "True", or "TrUe", is_bool is set to true: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MAkY.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/129651i3B5E2D947E6524D9/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MAkY.png" alt="0683p000009MAkY.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MAkY.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/129651i3B5E2D947E6524D9/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MAkY.png" alt="0683p000009MAkY.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MBFY.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/127912iF8DE9FB3A79A8CF7/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MBFY.png" alt="0683p000009MBFY.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;However, If I run it passing in "truetrue", "false", or "abcd", is_bool is set to (or remains) false: 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M8C4.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/134616iD7C265A0AE675B21/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M8C4.png" alt="0683p000009M8C4.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M8C4.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/134616iD7C265A0AE675B21/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M8C4.png" alt="0683p000009M8C4.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009M8C4.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/134616iD7C265A0AE675B21/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009M8C4.png" alt="0683p000009M8C4.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;So Talend appears to be converting it for me. 
&lt;BR /&gt;I would be curious to know if it also does the same for Dates, given it is entered in the proper format. 
&lt;BR /&gt;Regards, 
&lt;BR /&gt;Matthew</description>
      <pubDate>Thu, 16 Oct 2014 06:11:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352386#M118794</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-16T06:11:47Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to Receive a Date context parameter through the shell script?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352387#M118795</link>
      <description>you're right for boolean 
&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;try {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; context.chooce = routines.system.ParserUtils&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .parseTo_Boolean(context.getProperty("chooce"));&lt;BR /&gt;&lt;/PRE&gt;
&lt;BR /&gt;as declared as Boolean, Talend try to parse context flow (String) in a boolean.
&lt;BR /&gt;Assign null at exception :
&lt;BR /&gt;
&lt;PRE&gt;&lt;BR /&gt;catch (NumberFormatException e) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; context.chooce = null;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Oct 2014 11:21:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352387#M118795</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-16T11:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] How to Receive a Date context parameter through the shell script?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352388#M118796</link>
      <description>got it 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MACn.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/154443iC5B8CACEF3D12C6A/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MACn.png" alt="0683p000009MACn.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;trying to put a default date to my context give me the clue . 
&lt;BR /&gt; 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MB1x.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/157903i6B059E8E34B206E0/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MB1x.png" alt="0683p000009MB1x.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;you can put a "date' ( not really Date type ) with his pattern in the java commandline : (something like) 
&lt;BR /&gt; 
&lt;PRE&gt;&lt;BR /&gt;C:\Talend\test\boolParam_0.1\boolParam&amp;gt;boolParam_run.bat --context_param datej="&lt;BR /&gt;yyyy-MM-dd HH:mm:ss;2014-10-16 12:18:33"&lt;BR /&gt;&lt;/PRE&gt; 
&lt;BR /&gt;So you can 
&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009MA9p.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/138034i5F552429DA646D6F/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009MA9p.png" alt="0683p000009MA9p.png" /&gt;&lt;/span&gt; 
&lt;BR /&gt;regards 
&lt;BR /&gt;laurent</description>
      <pubDate>Thu, 16 Oct 2014 11:27:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-How-to-Receive-a-Date-context-parameter-through-the/m-p/2352388#M118796</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-10-16T11:27:48Z</dc:date>
    </item>
  </channel>
</rss>

