Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Amit_B
Creator
Creator

Displaying a file in an email from NP task

Hi everyone,

I have a text file, I put it's content into a variable in QV (using Include Statement), and I want to display this variable in the body of an email in a task.

The problem is that the NP ignores new lines in a text file, all the text is displayed on the same line.
This is how it looks in the file, in QV and in the email.

Amit_B_0-1695120912703.png

Is there a way to solve this problem?
Maybe loading the file content differently to QV (I tried to use PEEK and it didn't work) or split each line in a variable into a new variable?
It is important to say that the content of the file may change in terms of the number of lines.

Many thanks!

Labels (2)
1 Solution

Accepted Solutions
Ruggero_Piccoli
Support
Support

Hi,

Instead of placing the variable directly you could try to develop an HTML template with the variable (and other fixed text of content from Qlik Sense app or QlikView document). Then embed the HTML template in the email body and remove it from the attached files. In this case you can use all HTML feature to format the content and you can test the results with a third party tool that renders the email as different clients. 

Refer to https://help.qlik.com/en-US/nprinting/May2023/Content/NPrinting/DistributionSchedulesAutomation/Dist...

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.

View solution in original post

6 Replies
Ruggero_Piccoli
Support
Support

Hi,

Instead of placing the variable directly you could try to develop an HTML template with the variable (and other fixed text of content from Qlik Sense app or QlikView document). Then embed the HTML template in the email body and remove it from the attached files. In this case you can use all HTML feature to format the content and you can test the results with a third party tool that renders the email as different clients. 

Refer to https://help.qlik.com/en-US/nprinting/May2023/Content/NPrinting/DistributionSchedulesAutomation/Dist...

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Agree with Ruggero. I can se it only working if your text could be loaded with real html base line feeds so they are properly rendered as html. 
this can easily be achieved if text is loaded to a table and html encoding is disabled. That way you can create your text in file an include required syntax to break lines. 

i can provide example when i get access to my environment

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @Amit_B 

So I have done some testing and it all works for me as I expected.

  1. I have created a variable as shown below:
    1. set vEmailContent = 'Hello!<BR><BR>,How are you?<BR>What are we going to do with LF (Line Feed) variable issue?<BR>I think I have the answer 😎<BR>Use HTML report without encoding!!! 😎<BR><BR>Cheers';
  2. As you can see I breaks by applying <BR> wherever I want it
  3. I use that variable directly in email body (no need for HTML report to be created)
    1. Lech_Miszkiewicz_2-1695167538655.png

       


       

  4. I get results as expected:
    1. Lech_Miszkiewicz_1-1695167398969.png

       

So yeah - as expected this can be easily done. 

 

BY THE WAY - ignore my variable message (you dont need to use report at all) you just need to make sure your email is HTML 

 

cheers

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Amit_B
Creator
Creator
Author

Thank you very much for the detailed answer!

Can the variable you created be dynamic?
The text and the positions of the blank lines (<BR>) can change.
My client updates the text, and the updated text is emailed to his clients through the NP. I'm using NP for the client, I don't want to update the email/variable every time he changes the text.

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Of course it can. At the end it is very basic REPLACE() Qlik function, right? you replacing line carrier character with '<BR>' characters like below:

// Set variable text
Set vVariable = hello

123,
456,
789

xxx


best regards
NPrinting Qlikster;


//replace line carrier characters 
Let vVariable = Replace('$(vVariable)',Chr(13),'<BR>');

 

In my testing both CHR(13) and CHR(10) were working the same way.

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Amit_B
Creator
Creator
Author

Thanks!