<?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 Re: String truncation during transformation in Qlik Replicate</title>
    <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977550#M3649</link>
    <description>&lt;P&gt;Thanks Heinvandenheuvel&lt;/P&gt;
&lt;P&gt;Function SUBSTR is really truncate String to desired length. But it works only for String which defined on&amp;nbsp; the Source as Char or Varchar datatype.&lt;BR /&gt;But in my case I have LOB (text datatype) on the Source. Replicate when uses SUBSTR function for LOB column just send NULL to the target instead of truncated string&lt;/P&gt;</description>
    <pubDate>Tue, 06 Sep 2022 13:27:08 GMT</pubDate>
    <dc:creator>sergsyb</dc:creator>
    <dc:date>2022-09-06T13:27:08Z</dc:date>
    <item>
      <title>String truncation during transformation</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977377#M3640</link>
      <description>&lt;P&gt;I am sorry for may be trivial question, but in which way I can do transformation and truncate original string.&lt;BR /&gt;For example&lt;/P&gt;
&lt;P&gt;On the Source we have column with text datatype. (very long string)&lt;BR /&gt;On the Target I would like to truncate original long string and fit in char(20) for example&lt;/P&gt;
&lt;P&gt;If I only define new datatype for this column STRING (20) in Output of Transorm tab, new table with column char(20) creates on the target, but data for FULL LOAD contain long original string. As result target get error - original string could not fit in char(20)&lt;/P&gt;
&lt;P&gt;Which expression i should add to transformation to truncate original long string to 20 character?&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 09:42:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977377#M3640</guid>
      <dc:creator>sergsyb</dc:creator>
      <dc:date>2022-09-06T09:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: String truncation during transformation</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977399#M3641</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/192253"&gt;@sergsyb&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I think you are almost there. You may add function RTRIM() see the Supported&amp;nbsp;&lt;A title="functions" href="https://help.qlik.com/en-US/replicate/May2022/Content/Global_Common/Content/SharedEMReplicate/Customize%20Tasks/tasks_expressOther.htm" target="_blank" rel="noopener"&gt;functions&lt;/A&gt;&amp;nbsp;, a sample:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="john_wang_0-1662459572930.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/88363i941C0B72F2A7232E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="john_wang_0-1662459572930.png" alt="john_wang_0-1662459572930.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;where NAME is the column which you want to trim.&lt;/P&gt;
&lt;P&gt;However please take note you may get many warning messages ("Some of the source data was truncated in the target database") which reduce the performance. and I do not think the warning can be suppressed.&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;John.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 10:22:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977399#M3641</guid>
      <dc:creator>john_wang</dc:creator>
      <dc:date>2022-09-06T10:22:49Z</dc:date>
    </item>
    <item>
      <title>Re: String truncation during transformation</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977411#M3642</link>
      <description>&lt;P&gt;Thanks John,&lt;/P&gt;
&lt;P&gt;But I have tried to do it with help rtrim($c3,20) but it can't truncate data&lt;BR /&gt;See attached screenshot&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 10:36:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977411#M3642</guid>
      <dc:creator>sergsyb</dc:creator>
      <dc:date>2022-09-06T10:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: String truncation during transformation</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977424#M3644</link>
      <description>&lt;P&gt;Sorry&amp;nbsp;&lt;SPAN&gt;John, When I wrote previous reply&amp;nbsp; I just checked with ExpessionBulder and&amp;nbsp;ExpessionBulder did n't&amp;nbsp; show truncation. But now, I run task and show all data was truncated and fit into varhar (20).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks John.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;But why&amp;nbsp;ExpessionBulder doesn't show truncation properly?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 10:51:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977424#M3644</guid>
      <dc:creator>sergsyb</dc:creator>
      <dc:date>2022-09-06T10:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: String truncation during transformation</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977434#M3645</link>
      <description>&lt;P&gt;John ,&amp;nbsp;&amp;nbsp;I was happy too early.&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;With help of transformation rtrim($c3,20).&amp;nbsp; I don't get error now, but string was loaded as NULL into columnn which I expected will have truncated data.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So the question remain the same.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 11:11:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977434#M3645</guid>
      <dc:creator>sergsyb</dc:creator>
      <dc:date>2022-09-06T11:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: String truncation during transformation</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977454#M3646</link>
      <description>&lt;P&gt;John, according to documentation- Second parameter for rtrim function is not expected length for truncation.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;The rtrim(x,y) function returns a string formed by removing all characters that appear in y from the right side of x.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;So if data in c3 column stores as 'abcdef' &lt;BR /&gt;rtrim($c3, 'ef') will retunrn 'abcd'&lt;/P&gt;
&lt;P&gt;But what function will help to simply truncate string?&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 11:24:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977454#M3646</guid>
      <dc:creator>sergsyb</dc:creator>
      <dc:date>2022-09-06T11:24:21Z</dc:date>
    </item>
    <item>
      <title>Re: String truncation during transformation</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977522#M3648</link>
      <description>&lt;P&gt;&amp;gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;But what function will help to simply truncate string?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;SUBSTR&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.sqlitetutorial.net/sqlite-functions/sqlite-substr/" target="_blank"&gt;https://www.sqlitetutorial.net/sqlite-functions/sqlite-substr/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Heinvandenheuvel_0-1662468928631.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/88391i0577E17A2F3A19E2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Heinvandenheuvel_0-1662468928631.png" alt="Heinvandenheuvel_0-1662468928631.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 12:55:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977522#M3648</guid>
      <dc:creator>Heinvandenheuvel</dc:creator>
      <dc:date>2022-09-06T12:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: String truncation during transformation</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977550#M3649</link>
      <description>&lt;P&gt;Thanks Heinvandenheuvel&lt;/P&gt;
&lt;P&gt;Function SUBSTR is really truncate String to desired length. But it works only for String which defined on&amp;nbsp; the Source as Char or Varchar datatype.&lt;BR /&gt;But in my case I have LOB (text datatype) on the Source. Replicate when uses SUBSTR function for LOB column just send NULL to the target instead of truncated string&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 13:27:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977550#M3649</guid>
      <dc:creator>sergsyb</dc:creator>
      <dc:date>2022-09-06T13:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: String truncation during transformation</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977569#M3651</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/192253"&gt;@sergsyb&lt;/a&gt;&amp;nbsp;, copy&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/110970"&gt;@Heinvandenheuvel&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;BLOCKQUOTE&gt;But in my case I have LOB (text datatype) on the Source. Replicate when uses SUBSTR function for LOB column just send NULL to the target instead of truncated string&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is the reason. All the functions cannot be used for LOB data types (include BLOB/CLOB and other data types which will be handled as LOB), any transformation will lead the LOB columns become NULL. The only supported transformation is remove the column.&lt;/P&gt;
&lt;P&gt;BTW, what's the source DB?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;John.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 13:50:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977569#M3651</guid>
      <dc:creator>john_wang</dc:creator>
      <dc:date>2022-09-06T13:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: String truncation during transformation</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977586#M3652</link>
      <description>&lt;P&gt;John you wrote -&amp;nbsp;&lt;SPAN&gt;what's the source DB?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Source DB is&amp;nbsp; PostgreSQL 12&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 14:08:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977586#M3652</guid>
      <dc:creator>sergsyb</dc:creator>
      <dc:date>2022-09-06T14:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: String truncation during transformation</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977602#M3654</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/192253"&gt;@sergsyb&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Please allow me some time, Let me see if we can find a workaround for it or not.&lt;/P&gt;
&lt;P&gt;Will get back to you later.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;John.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 14:15:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977602#M3654</guid>
      <dc:creator>john_wang</dc:creator>
      <dc:date>2022-09-06T14:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: String truncation during transformation</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977686#M3655</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/192253"&gt;@sergsyb&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I think the most easy way is using&amp;nbsp;MATERIALIZED VIEW, we cut the CLOB column to 20 chars in the view, for example:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;  create MATERIALIZED VIEW public.testtext_vw as 
  select id,name,notes,substring(notes from 1 for 20) from public.testext;
  REFRESH MATERIALIZED  VIEW public.testtext_vw;&lt;/LI-CODE&gt;
&lt;P&gt;Unfortunately PostgreSQL Logical Replication does not support&amp;nbsp;&amp;nbsp;MATERIALIZED VIEW. See&amp;nbsp;&lt;A title="...must be normal tables, not views, materialized views..." href="https://www.postgresql.org/docs/12/logical-replication-restrictions.html" target="_blank" rel="noopener"&gt;...must be normal tables, not views, materialized views...&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So we have to get back to Replicate again. Let's use&amp;nbsp;&lt;A title="source_lookup" href="https://help.qlik.com/en-US/replicate/May2022/Content/Global_Common/Content/SharedEMReplicate/Customize%20Tasks/tasks_expressOther.htm#Data2" target="_blank" rel="noopener"&gt;source_lookup&lt;/A&gt;&amp;nbsp;function. In your current transformation, change the expression to&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;source_lookup('NO_CACHING','public','testext','substring(notes from 1 for 20)','id=?',$id)&lt;/LI-CODE&gt;
&lt;P&gt;where 'public' is the schema name, 'testtext' is the table name, 'notes' is CLOB column, 'id' is the table PK.&lt;/P&gt;
&lt;P&gt;I hope it solve the issue.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;John.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 15:36:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977686#M3655</guid>
      <dc:creator>john_wang</dc:creator>
      <dc:date>2022-09-06T15:36:43Z</dc:date>
    </item>
    <item>
      <title>Re: String truncation during transformation</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977716#M3656</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/192253"&gt;@sergsyb&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please have a look at this source lookup function as it will do a lookup into the source field and it should return the LOB value as string and then the substr function should work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Transformation: Source Lookup - Oracle ROWID 5/4 ( Ted )&lt;BR /&gt;&lt;A href="https://community.qlik.com/t5/Knowledge/Transformation-Source-Lookup-Oracle-ROWID/ta-p/1805170" target="_blank"&gt;https://community.qlik.com/t5/Knowledge/Transformation-Source-Lookup-Oracle-ROWID/ta-p/1805170&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Please let me know if this helps out.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;BR /&gt;Michael&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 17:10:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977716#M3656</guid>
      <dc:creator>Michael_Litz</dc:creator>
      <dc:date>2022-09-06T17:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: String truncation during transformation</title>
      <link>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977772#M3657</link>
      <description>&lt;P&gt;Hi John, Michael&lt;/P&gt;
&lt;P&gt;You are simply the best. Thanks a lot for your suggestion re Lookup &amp;nbsp;function.&lt;/P&gt;
&lt;P&gt;Finally, with help of this function we managed to successfully replicate truncated LOB value to the target..&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 19:18:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Replicate/String-truncation-during-transformation/m-p/1977772#M3657</guid>
      <dc:creator>sergsyb</dc:creator>
      <dc:date>2022-09-06T19:18:11Z</dc:date>
    </item>
  </channel>
</rss>

