Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a LOOP and a LOAD where, in every iteration, a nr. of records is added to the output_table.
=> Is there a command I can use to find out the nr. of records that are added in each iteration? Then I guess I'd have to add another
field to the table where I can store that figure which I need to display in a straight_table on the GUI.
Thanks a lot!
Best regards,
DataNibbler
How does your script look like today?? Without seeing what you have, it might be difficult to give suggestionss
Can you please provide more I/P?
The function NoOfRows('tablename') will return the current number of records in a table.
-Rob
Hi DataNibbler,
maybe with a further load within the loop like:
NumberOfRecords:
load
noofrows('Transaktionen_Archiv_$(i)') as Records, 'Transaktionen_Archiv_$(i)' as Table, $(i) as LoopCounter
autogenerate 1;
- Marcus
Hi all,
thanks for the quick answers!
I do think the question was a simple, and above all, totally context-independent one, wasn't it? When I ask for a complete solution or something similar, I well understand that seeing the script would be most helpful - but here I just wanted to know whether (or not) there is a command to return this figure ... well, never mind.
I know the NoofRows() function and I have already thought of it - but currently I have it all in one big table, so that figure would change with every iteration. I would need a second variable or something to calculate the nr. of records I just added to the total - or I change the script so that I get several tables, one for each iteration, each with a field depicting the NrOfRows(), and append them all in the end. Very much like what Marcus suggested.
I guess I'll go that way, it seems to be the easiest.
Best regards,
DataNibbler
Hi DataNibbler,
here a slight change if you are loading a big table and not some separate slices:
NumberOfRecords:
load
noofrows('Transaktionen_Archiv') as RecordsTotal,
peek('FileName', $(i) -1, 'Transaktionen_Archiv') as File, $(i) as LoopCounter,
noofrows('Transaktionen_Archiv') - peek(' RecordsTotal', $(i) - 1, ' NumberOfRecords') as RecordsFile
autogenerate 1;
whereby FileName is a field createc per filebasename() within your transactions.
- Marcus
"I have a LOOP and a LOAD where, in every iteration, a nr. of records is added to the output_table."
So wouldn't you use the NoOfRows() at the end of each iteration?
-Rob
Hi Rob,
I would - but I will have to combine that with another variable like Marcus suggested, or the NoOfRows() would logically increase with every iteration, which would not be correct - so I have to include in the LOAD, or in a separate one, a field depicting the NoOfRows(), and in the next iteration I can use NoOfRows() again and subtract the value in that field - something like that. It's a pity there isn't a function tailor-made for LOOPs which would just directly return the nr. of records added in one single iteration, but I'll get it sorted anyhow.
Thanks a lot!
Best regards,
DataNibbler
P.S. @ Marcus
Do I need the FileName here? that doesn't change since I append all the records into one table ...