Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Ribeiro
Specialist
Specialist

Case table 2 has no number in Table1 EXIT SCRIPT

See below for table2. number 6 is not in table 1. Then it should stop the script and exit

Example record number 6 is not in Table2. Then it must stop the script and exit the load

The records in Table 2. should belong to Table 1. EXIT SCRIPT

table1:
LOAD * INLINE [
ID
10
9
8
7
6

];

table2:
LOAD * INLINE [
ID
10
9
8
7

];

Neves
1 Solution

Accepted Solutions
Nicole-Smith

The following code works and exits script for ID 6 (displays message so you also know which ID was not found).  I did name the ID in table2 to ID2 so we can compare one to the other.

table1:
LOAD * INLINE [
	ID
	10
	9
	8
	7
	6
];

table2:
LOAD ID as ID2 INLINE [
	ID
	10
	9
	8
	7
];

FOR EACH i IN FieldValueList('ID')
	IF FieldIndex('ID2', $(i)) = 0 THEN
		TRACE ID $(i) NOT FOUND;
		EXIT SCRIPT
	ENDIF
NEXT i

View solution in original post

3 Replies
Nicole-Smith

The following code works and exits script for ID 6 (displays message so you also know which ID was not found).  I did name the ID in table2 to ID2 so we can compare one to the other.

table1:
LOAD * INLINE [
	ID
	10
	9
	8
	7
	6
];

table2:
LOAD ID as ID2 INLINE [
	ID
	10
	9
	8
	7
];

FOR EACH i IN FieldValueList('ID')
	IF FieldIndex('ID2', $(i)) = 0 THEN
		TRACE ID $(i) NOT FOUND;
		EXIT SCRIPT
	ENDIF
NEXT i
Ribeiro
Specialist
Specialist
Author

A tabela Nest For 2 não tem o número 6, portanto, o script não deve continuar. Ele deve ler a tabela 2 e comparar com a tabela 1.

Table2: should have records from table1: If not all of them are missing, 6. it should run the script.


If table 2 contains records from table 1.
Then go on. If not Exit Script

Neves
Ribeiro
Specialist
Specialist
Author

😇

Sorry is right. I didn't understand.
Thank you very much

Neves