Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi, people.
I need get the row count of tables from a module Function.
The editor isn't integrated into object-model and I look for any
reference about Application.Tables or ActiveDocument.Tables, etc.
Than, I try a lot of expression., but nothing works.
I would like something like:
Function RecordCount(vanTableName)
dim d
d = Application.RowNo(vanTableName)
RecordCount = d
End Function
How can I get this using modules?
Hi, Marcus.
I understood what the code you send do. And I know that a system of logs is very useful.
But, note what I see:
1. the task of load data must include the code to record logs: makes working more complex;
2. any kind of update in order of load data, probaly, will denote changes in code: morr and more complex;
3. I need, at least, two "IFs" more to get the state of table;
4. to reuse the code, I need write it again or, if a build some kind of script macro
using $(variables), then, I will need check several parts of code to do not
interfere in others features.
If QlikView, yet, had no features to read the states of tables during the load process from a VBA or JavaScript module, is there a way to return a value from your own macros? I could see the statments SUB ... ENDSUB. Is there some statment to return a value to its caller?
Thanks.
...
Ricardo Ildefonso
During the script-execution isn't any access through vba or js on tables and rows possible. Why want you put your checks in "extern" routines? Which adantage is expected? All your needs could be easily done with the table-functions and a few control-statements like if-then-else or sub-end sub, especially if you used further check-routines with filetime() or ErrorMode. There also the possibility to execute some batches or vbs during the reload so that you could check this etl-line from outside or you nested several etl-lines - but this could be very complicated ... generally all things are possible inside the script-execution.
The code to read these table-informations musn't be so large how in my example if TableName() and NoofRows() is enough and you could put these code in a include-variable or a sub. In summary: I think there isn't any other way to do this with lesser effort.
- Marcus
1. You can't access table properties from a VB routine via script.
2. The function to get number of rows in a table already exists as a script function "NoOfRows('tablename')".
3. Script SUBs can't return values like functions.
4. If you want to modify NoOfRows so it returns -1 instead of null for empty table, you can create your own version as a variable with parameter like this:
SET myNoOfRows = alt(NoOfRows('$1'),-1);
and call it in script as:
$(myNoOfRows('mytable'))
-Rob
Good morning, good day... Marcus and Rob.
Thanks for the help.
I will use the feature "variable with parameter"... It is powerful!!
In fact, I can see a lot of situations that it will be util.
About modules and macros, I have other features where they are necessary.
The code become simpler and I had tryed several types of ApplyMap and MapSubString that can't solve my needs of data sanitation.
But now I will use parameters variables to solve that stuff about records count.
Once more time: thans, thanks, thanks.
...
Ricardo Ildefonso