You cant do that I am afraid, the present of NewTestField will trigger an error in the load even if you are not using it. You can split this into two load expressions like this:]
If ProdTest = 'T' Then items: load itemno, itemname, NewTestField FROM $(Server)\Qvd\items.qvd (qvd); Else items: load itemno, itemname, null() As NewTestField FROM $(Server)\Qvd\items.qvd (qvd); End If
The null() is to ensure that the two load statements auto concatenate.
Hope that helps
PS you could alos use LOAD * FROM .... to load all the fields, but you may have concatenation issues.
Try loading the script into a variable similar to this example ...
LOAD * INLINE [
itemno, itemname, TestField
A, Apples, Cooking Apples
B, Bananas, Small Bananas
C, Carrots, Baby Carrots
D, Duck, Duck a l'Orange
E, Eggs, Easter Eggs];
LET ProdTest = ', TestField as TestField_new';
//LET ProdTest = '';
LET vLoadScript =
'itemno as itemno_new,
itemname as itemname_new' &
' resident OriginalData'; // note preceding space
LOAD $(vLoadScript) ;
This is the best solution. But I was hoping for a simple elegant solution and there seem to be none. All those solutions results in a script that gets complicated to read when I have a document that has 10 tables and all of them need to be able to be read from two different sources. Thanks for all help though! Appreciate it!