Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

What is the character for line feed

Hello qlikers 🙂 ,

I want to remove a line feed. What is the character for a line feed?

text(trim(purgechar(ScriptErrorList, 'CHARACTERLINEFEED')));

Thank you in advance. Looking forward to reading some answers! 🙂 

Labels (4)
1 Solution

Accepted Solutions
sunny_talwar

Try this may be

Raw:
LOAD SupplierID,
	 Date#(ProductionDate, 'MM/YYYY') as ProductionDate,
	 Production,
	 Delivery;
LOAD * INLINE [
    SupplierID, ProductionDate, Production, Delivery
    5, 11/2018, des, 415
    5, 12/2019, as, 15421
    5, 01/2020, des, 14487
    10, 05/2019, des, 51122
    10, 06/2019, des, 14415
    10, 12/2019, as
];

MinMaxDate:
LOAD Min(Date#(ProductionDate, 'MM/YYYY')) as MinDate,
	 Max(Date#(ProductionDate, 'MM/YYYY')) as MaxDate
Resident Raw;

LET vMin = Peek('MinDate',0,'MinMaxDate');
LET vMax = Peek('MaxDate',0,'MinMaxDate');

Supplier:
LOAD Distinct
	 SupplierID,
	 Production
Resident Raw;

TRACE $(vMin);
TRACE $(vMax);

LET vRow = NoOfRows('Supplier');

FOR i = 0 to $(vRow)-1
	LET vSupplierID = Peek('SupplierID',$(i),'Supplier');
	LET vProduction = Peek('Production',$(i),'Supplier');
	
	TRACE $(vSupplierID);

	Concatenate(Raw)
	ZeroValue:
	LOAD Date#(text(Date($(vMin)-1+IterNo(),'MM/YYYY')),'MM/YYYY') as ProductionDate,
		 '$(vSupplierID)' as SupplierID
	AutoGenerate 1	
	While $(vMin)-1+IterNo()<$(vMax)+1;

NEXT i

NoConcatenate
Data:
LOAD ProductionDate,
	 SupplierID,
	 Production,
	 Delivery
Resident Raw
Order By ProductionDate, SupplierID;

//NoConcatenate
FOR i = 0 to $(vRow)-1
	LET vSupplierID = Peek('SupplierID',$(i),'Supplier');

	Data2:
	LOAD *,
		 1 as Flag
	Resident Data
	WHERE Peek(ProductionDate) <> ProductionDate and SupplierID = '$(vSupplierID)';

NEXT i
DROP Tables Supplier, Raw, Data;


LOAD *
From abc.qvd;

//SET ErrorMode=0;
LET vStartTime = TimeStamp(Now());
//SET vBackupPath = 'Log/';
LET vError;
LET vComment;

TestTabelle:
LOAD 0 as Dummy
AutoGenerate 0;

//LET vTotalErrors = ScriptErrorCount;
//TRACE $(vTotalErrors);

IF ScriptErrorCount > 0 THEN

	LET vError = 1;
	LET vComment = ScriptErrorList;
	TRACE $(vComment);
	LET vComment = Trim(Left(Replace(Replace(ScriptErrorList, Chr(13),  ' + '), Chr(10), ''), Index(Replace(Replace(ScriptErrorList, Chr(13),  ' + '), Chr(10), ''), ' +', -1)));
	TRACE $(vComment);
ELSE
	vError = 0;
	vCommen = null();
END IF

LET vEndTime = TimeStamp(Now());
LET vApplicationName = DocumentName();

Concatenate(TestTabelle)
LOAD * INLINE [
    Application, Start Time, End Time, Failed, Comment
    '$(vApplicationName)', $(vStartTime), $(vEndTime), $(vError), $(vComment)
];

STORE TestTabelle into 'log.csv' (txt);

View solution in original post

6 Replies
sergio0592
Specialist III
Specialist III

Hi, line feed is chr(10)

Anonymous
Not applicable
Author

Thank you for your support! Unfortunately my output doesen't look good. 

asdad.PNG

Do you have another ideas? Thank you in advance! 🙂

sunny_talwar

What exactly is your input and what exactly are you hoping to see as your output here?

Anonymous
Not applicable
Author

My input

 

Raw:
load SupplierID,Date#(ProductionDate, 'MM/YYYY') as ProductionDate,Production,Delivery inline [
SupplierID,ProductionDate,Production,Delivery
5,11/2018,des,415
5,12/2019,as,15421
5,01/2020,des,14487
10,05/2019,des,51122
10,06/2019,des,14415
10,12/2019,as,
];
MinMaxDate:
Load
Min(Date#(ProductionDate, 'MM/YYYY')) as MinDate,
Max(Date#(ProductionDate, 'MM/YYYY')) as MaxDate
Resident Raw;

let vMin =peek('MinDate',0,'MinMaxDate');
let vMax =peek('MaxDate',0,'MinMaxDate');

Supplier:
load distinct
SupplierID,Production
resident Raw;
trace $(vMin);
trace $(vMax);
let vRow=NoOfRows('Supplier');

for i=0 to $(vRow)-1
let vSupplierID = peek('SupplierID',$(i),'Supplier');
let vProduction = peek('Production',$(i),'Supplier');
trace $(vSupplierID);

Concatenate(Raw)
ZeroValue:
load
Date#(text(Date($(vMin)-1+IterNo(),'MM/YYYY')),'MM/YYYY') as ProductionDate,
'$(vSupplierID)' as SupplierID
AutoGenerate 1	
while $(vMin)-1+IterNo()<$(vMax)+1;

next ig



NoConcatenate
Data:
load 
	ProductionDate,
	SupplierID,
	Production,
	Delivery
resident Raw
order by
ProductionDate,
SupplierID;


//NoConcatenate
for i =0 to $(vRow)-1
let vSupplierID = peek('SupplierID',$(i),'Supplier');
Data2:
load *, 1 as Flag resident Data
WHERE
peek(ProductionDate)<>ProductionDate
and SupplierID='$(vSupplierID)'
//peek(SupplierID)=SupplierID;
;
next i
drop table Supplier;
drop table Raw;
drop table Data;


LOAD * from abc.qvf;




//SET ErrorMode=0;
LET vStartTime = TimeStamp(Now());
//SET vBackupPath = 'Log/';
SET vError;
LET vComment;



IF ScriptErrorCount > 0 THEN

vError = 1;
vComment = ScriptErrorList;
//let vComment = text(trim(purgechar(ScriptErrorList, 'chr(13)')));;
ELSE
vError = 0;
vCommen = null();
END IF

LET vEndTime = TimeStamp(Now());
Let vApplicationName = DocumentTitle();
Concatenate(TestTabelle)
Load * Inline [
Application, Start Time,End Time,Failed, Comment
$(vApplicationName),$(vStartTime),$(vEndTime), $(vError), $(vComment)];

Store TestTabelle into 'log.csv' (txt);

 

 

The ouput

asdasdsadsadadad.PNG

What I want

 

51515151515151.PNG

 

What I currently get

 

let vComment = replace('$(vComment)', chr(13), '+');

 

ddgfdg.PNG

 

I hope this will help you. Let me know. Thank you! 🙂

sunny_talwar

Try this may be

Raw:
LOAD SupplierID,
	 Date#(ProductionDate, 'MM/YYYY') as ProductionDate,
	 Production,
	 Delivery;
LOAD * INLINE [
    SupplierID, ProductionDate, Production, Delivery
    5, 11/2018, des, 415
    5, 12/2019, as, 15421
    5, 01/2020, des, 14487
    10, 05/2019, des, 51122
    10, 06/2019, des, 14415
    10, 12/2019, as
];

MinMaxDate:
LOAD Min(Date#(ProductionDate, 'MM/YYYY')) as MinDate,
	 Max(Date#(ProductionDate, 'MM/YYYY')) as MaxDate
Resident Raw;

LET vMin = Peek('MinDate',0,'MinMaxDate');
LET vMax = Peek('MaxDate',0,'MinMaxDate');

Supplier:
LOAD Distinct
	 SupplierID,
	 Production
Resident Raw;

TRACE $(vMin);
TRACE $(vMax);

LET vRow = NoOfRows('Supplier');

FOR i = 0 to $(vRow)-1
	LET vSupplierID = Peek('SupplierID',$(i),'Supplier');
	LET vProduction = Peek('Production',$(i),'Supplier');
	
	TRACE $(vSupplierID);

	Concatenate(Raw)
	ZeroValue:
	LOAD Date#(text(Date($(vMin)-1+IterNo(),'MM/YYYY')),'MM/YYYY') as ProductionDate,
		 '$(vSupplierID)' as SupplierID
	AutoGenerate 1	
	While $(vMin)-1+IterNo()<$(vMax)+1;

NEXT i

NoConcatenate
Data:
LOAD ProductionDate,
	 SupplierID,
	 Production,
	 Delivery
Resident Raw
Order By ProductionDate, SupplierID;

//NoConcatenate
FOR i = 0 to $(vRow)-1
	LET vSupplierID = Peek('SupplierID',$(i),'Supplier');

	Data2:
	LOAD *,
		 1 as Flag
	Resident Data
	WHERE Peek(ProductionDate) <> ProductionDate and SupplierID = '$(vSupplierID)';

NEXT i
DROP Tables Supplier, Raw, Data;


LOAD *
From abc.qvd;

//SET ErrorMode=0;
LET vStartTime = TimeStamp(Now());
//SET vBackupPath = 'Log/';
LET vError;
LET vComment;

TestTabelle:
LOAD 0 as Dummy
AutoGenerate 0;

//LET vTotalErrors = ScriptErrorCount;
//TRACE $(vTotalErrors);

IF ScriptErrorCount > 0 THEN

	LET vError = 1;
	LET vComment = ScriptErrorList;
	TRACE $(vComment);
	LET vComment = Trim(Left(Replace(Replace(ScriptErrorList, Chr(13),  ' + '), Chr(10), ''), Index(Replace(Replace(ScriptErrorList, Chr(13),  ' + '), Chr(10), ''), ' +', -1)));
	TRACE $(vComment);
ELSE
	vError = 0;
	vCommen = null();
END IF

LET vEndTime = TimeStamp(Now());
LET vApplicationName = DocumentName();

Concatenate(TestTabelle)
LOAD * INLINE [
    Application, Start Time, End Time, Failed, Comment
    '$(vApplicationName)', $(vStartTime), $(vEndTime), $(vError), $(vComment)
];

STORE TestTabelle into 'log.csv' (txt);
Anonymous
Not applicable
Author

Thank you very much for your great support! It worked perfectly! 🙂
I wish you a good day!