Qlik Community

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
QlikWorld 2022, LIVE in Denver CO., May 16-19, 2022. REGISTER NOW TO RECEIVE EARLY BIRD PRICING
cancel
Showing results for 
Search instead for 
Did you mean: 
martynwb
Contributor III
Contributor III

Trouble loading table before REST API get

I'm struggling to properly load some data. I need to pull some data from a QVD file, sort it by a timestamp, pull the most recent record and take one field from that 'row'. However, I cannot get any data to load into the table structure, despite the same code working elsewhere.

Here is the pseudo-code:

Get existing data:

TABLE1:

LOAD
   timestamp,
   checkpoint

FROM [lib://QVD.QVD]

(qvd);

TABLE2:

FIRST 1 LOAD *
RESIDENT TABLE1
ORDER BY timestamp DESC;

LET CHECKPOINT_TOKEN = [checkpoint];

Make API call with the above variable. However, using trace for this variable, it is always blank.

Can anybody help?

Thanks

Labels (2)
1 Solution

Accepted Solutions
Levi_Turner
Employee
Employee

Hey there,

This is likely what you're looking for:

// Build table
[t1]:
LOAD * INLINE [
timestamp,checkpoint
2021-03-11 12:46:00,A
2021-03-11 12:47:00,B
];

// Load second table with reverse ordering by timestamp
[t2]:
NoConcatenate
FIRST 1 LOAD
	*
Resident [t1] ORDER by [timestamp] DESC;

DROP TABLE [t1];

// Inspect the first (and only) record in t2
LET CHECKPOINT_TOKEN = Peek('checkpoint',0);

TRACE $(CHECKPOINT_TOKEN);

View solution in original post

1 Reply
Levi_Turner
Employee
Employee

Hey there,

This is likely what you're looking for:

// Build table
[t1]:
LOAD * INLINE [
timestamp,checkpoint
2021-03-11 12:46:00,A
2021-03-11 12:47:00,B
];

// Load second table with reverse ordering by timestamp
[t2]:
NoConcatenate
FIRST 1 LOAD
	*
Resident [t1] ORDER by [timestamp] DESC;

DROP TABLE [t1];

// Inspect the first (and only) record in t2
LET CHECKPOINT_TOKEN = Peek('checkpoint',0);

TRACE $(CHECKPOINT_TOKEN);

View solution in original post