Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

Define the nr. of records currently being loaded?

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

8 Replies
sunny_talwar

How does your script look like today?? Without seeing what you have, it might be difficult to give suggestionss

Anil_Babu_Samineni

Can you please provide more I/P?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The function NoOfRows('tablename') will return the current number of records in a table.

-Rob

marcus_sommer

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

datanibbler
Champion
Champion
Author

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

marcus_sommer

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

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

"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

datanibbler
Champion
Champion
Author

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 ...