You might have noticed I used this in the last example. AutoGenerate is so useful and has so many use cases. I probably use this in every app I create: from empty stub tables , generating a new field using another’s unique values, or as a way to log different steps within the load.
What it does is generate a table with the number of rows specified. This means you can create records with the output of functions, variables or strings without needing to specify a source.
Here is an example, which includes another tip if you catch it:
// Create empty table and setting field types Log: Load Null() as [Log.Table], Num(Null(),'#,##0') as [Log.Rows], Timestamp(Null()) as [Log.Timestamp] AutoGenerate (0); Fact: LOAD TransLineID, TransID, "Num", Dim1, Dim2, Dim3, Expression1, Expression2, Expression3 FROM [lib://QVD/SampleTransactions.qvd](qvd); // Add Log record Concatenate(Log) Load 'Fact' as [Log.Table], NoOfRows('Fact') as [Log.Rows], Now() as [Log.Timestamp] AutoGenerate (1);