Ok, I think I know what's going on (should have noticed that before).
First, I think your last snippet misses some dollar sign expansions in the STORE statement line:
for i = 0 to NoOfTables() -1
LET vTableName= TableName( $(i) );
LET vOutfile= '$(vTableName).qvd';
STORE $(vTableName) into [QVD\$(vOutfile)] (qvd);
But that's not the problem. In step 2, you are loading a resident table with exact same field names as the resident table shows, this will provoke an automatic concatenation. So, what you expect to be Table xyz is not the table loaded in step 2 (this one is, is said concatenated to table ABC).
The table name xyz is now applied to your next inline table load (step 3), which you can also see looking at the table viewer.
So the load does not fail, due to the concatenation you are getting one table less than expected and table names xyz contains the Step 3 INLINE table.
If you don't want to concatenate, rename some fields in step 2 or use NOCONCATENATE load prefix.
Hope this helps,
Ok, let's go back to the beginning:
I understood from your original post, that your script runs without any error reported, right? And if you say "fail", you mean the qvd creation code for the step 3 table is not performed / missing.
- on what version of QV are you?
- have you tried stepping through the code calling the script debugger from editor?
I loaded a simple table from excel as table ABC, then executed your code above and the loop. With QV11, QV10SR2 and QV9, I got the same results: I got a concatenation for table ABC or, if I change field names, I get all tables stored in QVDs.
Since you are experiencing something different, I think your script code is essentially different from what I just described / assumed or from what you have posted.
So maybe you could create a sample qvw file that demonstrates the issue and upload it here?