I have literally no app load script that has not one or the other inline table. This is an inline table as you would learn it in the Qlik Sense classes:
LOAD * INLINE [
name, age
Christof, 49
Dhruv, 27
];
This is the simple and most commonly known syntax. Field content is automatically trimmed (no leading/trailing spaces), type is auto-detected (number as number, text as text), and standard delimiter is a comma. You know, that you can use ' ' or " " quotation if the delimiter (comma) is part of the text itself?
LOAD * INLINE [
id, age, name
PDR, 10, “De Redelijkheid, Paul”
CSW, 20, ‘Schwarz, Christof “Blacky”’
];
However, there is much more about it.
- You can alter the opening and closing quotation of the inline table: instead of [ ] you can use ` ` or " " (helpful especially if a square bracket is part of the field content)
- You can exchange the delimiter to something else than a comma (e.g. ";" or "^")
- You can work without a header line and "comment out" rows with the help of a WHERE-clause
- You can immediately add calculated columns right after the LOAD * ...
So look at this and try to understand what it does ... I am combining below what I just explained:
inline:
LOAD
@1 AS types,
If(@2 LIKE ‘[*]‘, @2, ‘[’ & @2 & ‘]’) AS fields
INLINE `
numFields ^ [D],[E]
// textFields ^ [F],[G]
textFields ^ [F],[G],[H]
dateFields ^ J
` (delimiter is ‘^’, no labels)
WHERE NOT @1 LIKE ‘//*’;
The outcome is the following table:
What Qlik loads after the above code
The table has "auto-headers" called @1, @2 ... one line was "commented out" using WHERE ... since I needed "[" and "]" to be part of the field content itself, I exchanged the table quotation to "`" and the field separator to "^". I am adding a formula that manipulates the @2 column to add "[" and "]" around the field value if not contained already.
Here is my last one:
- You can even change the type of the inline-block
Typically, we provide txt content (csv). But the type parameter can be altered to XmlSimple or - at least already on Qlik Cloud - to Json !
LOAD * INLINE `
[
{ “name”: “Christof”, “age”: 49, “partner”: true },
{ “name”: “Dhruv”, “age”: 27 }
]
` (json);
Yippee!