Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Is there a function to get a list of the --script-- tab names?
Use case: Writing an extract tables to qvds app and there will be one script tab per d/b table. I would like to put a list of all of the script tab names (aka: database tables) on the presentation tab.
John
Hi,
I am asking a similar question.
Listing QVD and File Extensions in Script
Some solution is available but I haven't found yet a solution like what you describe which is also what I am looking for.
Principle of Solutions :
1. Put all your loaded QVDs into a same directory and list those (see answer of Martin Re: Listing QVD and File Extensions in Script )
2. If you are Happy only having table's names you can use a list box with &Table in the front end or do it as script (3)
3.
For vTable = 0 to NoOfTables()-1
LET vTableName = TableName($(vTable)) ;
[Data Sources]:
Load '$(vTableName)' as [Table Name],
'$(vTable)' as [Table Nr],
filename() as [Filename]
next vTable
4. You can set in each table the fields as below and eventually you can run in the script a concatenate table search to get those names into one single table.
[My Table 1]
LOAD
[%KEY] as [%My KEY],
[My Field 1],
filename( ) as [My File Name],
FilePath() as [My File Path],
FileExtension() as [My File Extension]
FROM path/My_Table.QVD (qvd) ;
5. You can read the loading log file to gather the QVDs names. You just need to have a clean script to avoid double work on looking for the right field.
However I am still going and looking for a more direct solution, like load all QVDs names into a table and ignore if tables are joined ...
I hope this helps,
Alen
Thanks for the reply, Alen.
We are using a dual stage .qvd process - one (or more) extract apps and then one (or more) transform apps.
re: solution 1: Because the .qvds from multiple extract apps are saved into a common folder, this would not give us a per extract app list & status..
re: solution 2/3: Because we load each table from the d/b, save it to a .qvd, then drop that table, this would not work.
re: solution 4: I do not want to modify the tables in any way in the extract process.
However, you did give me an idea. Just before I drop each table, I could grab that table name (and possible # rows) and insert it into a TabNameTable and display that. I think I can generalize it enough so it would not need to be customized for each tab/table. This only gives me the table names and not the tab names, but that is a reasonable compromise.
John
I added this code snippet to every load / store we do and added an object on the presentation page of the qvd extract app to show the list of all tables loaded in this app.
I was unable to find a way IN THE SCRIPT to get the number of rows in a table. NoOfRows does not work in scripts, just objects.
John
STORE ...
// ----------------------------------------
// Add this table name to the resident table
LET vTableName = TableName(NoOfTables()-1); // get the most recently created table name
TableName:
Load * INLINE [TableName
'$(vTableName)'];
// ----------------------------------------
DROP Table ...
Hi John,
indeed it sounds as a good compromise.
For the number of rows in the table, have you tried to get the RowNo(TOTAL) and then peek the max?
Alternatively you could assign '1' as [RowNr] and count.
Just thoughts as I am not sure it is streightforward to be done also including the variable.
Alen