Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
satishqlik
Creator II
Creator II

Load tables

Hi All,

I've been trying to load all tables from database

and creating QVDs automatically but not working properly.

If I add [] its getting an error and It working be fine if the table name has no spaces.

Suggest me on this where am wrong.

Tablelist:

LOAD*

Inline

[Tablename

Categories

Customers

Divisions

Order Details

Products

Shippers

Shipments

];

FOR i=1 to FieldValueCount('Tablename')

LET Vtable= FieldValue('Tablename',i);

SQL SELECT *

FROM [$(Vtable)];

SET VQvdPath= D:\Practice\Data\QVDS\;

STORE [$(Vtable)] into $(VQvdPath)[$(Vtable)].qvd(qvd);

NEXT

Any suggestions will be appreciated.

1 Solution

Accepted Solutions
sunny_talwar

Can you try this:

FOR i=1 to FieldValueCount('Tablename')

    LET Vtable = '[' & FieldValue('Tablename', $(i)) & ']';

  $(Vtable):

    SQL SELECT *

    FROM $(Vtable);

    SET VQvdPath= D:\Practice\Data\QVDS\;

    STORE $(Vtable) into $(VQvdPath)$(Vtable).qvd(qvd);

NEXT

or

FOR i=1 to FieldValueCount('Tablename')

    LET Vtable = '[' & FieldValue('Tablename', $(i)) & ']';

    LET VtableStore = FieldValue('Tablename', $(i));

    $(Vtable):

    SQL SELECT *

    FROM $(Vtable);

    SET VQvdPath= D:\Practice\Data\QVDS\;

    STORE $(Vtable) into $(VQvdPath)$(VtableStore).qvd(qvd);

NEXT

View solution in original post

17 Replies
sunny_talwar

How about this:

Tablelist:

LOAD * Inline[

Tablename

Categories

Customers

Divisions

Order Details

Products

Shippers

Shipments

];

FOR i=1 to FieldValueCount('Tablename')

    LET Vtable = '[' & FieldValue('Tablename', $(i)) & ']';

    SQL SELECT *

    FROM $(Vtable);

    SET VQvdPath= D:\Practice\Data\QVDS\;

    STORE $(Vtable) into $(VQvdPath)$(Vtable).qvd(qvd);

NEXT

satishqlik
Creator II
Creator II
Author

Thanks Sunny but not working still its getting an error. PFB for your ref.

error.jpg

sunny_talwar

Did you also fix the i -> $(i)?

sunny_talwar

Also try this:

FOR i=1 to FieldValueCount('Tablename')

    LET Vtable = FieldValue('Tablename', $(i));

    SQL SELECT *

    FROM $(Vtable);

    SET VQvdPath= D:\Practice\Data\QVDS\;

    STORE $(Vtable) into $(VQvdPath)$(Vtable).qvd(qvd);

NEXT

satishqlik
Creator II
Creator II
Author

Yes! Its working fine if the table name has no spaces.

But what about Order Details table?

sunny_talwar

Would you be able to share the application?

satishqlik
Creator II
Creator II
Author

PFB of your reference. !

share2.jpg

sunny_talwar

So this for sure wasn't working:

FOR i=1 to FieldValueCount('Tablename')

    LET Vtable = '[' & FieldValue('Tablename', $(i)) & ']';

    SQL SELECT *

    FROM $(Vtable);

    SET VQvdPath= D:\Practice\Data\QVDS\;

    STORE $(Vtable) into $(VQvdPath)$(Vtable).qvd(qvd);

NEXT

Above we have the square brackets and also $(i) instead of i?

antoniotiman
Master III
Master III

Hi Satish,

try

SQL SELECT *  FROM "$(Vtable)";

and

Store "$(Vtable)" ..........

Remove []

Regards,

Antonio