Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

qvd files in same directory with different fields

I have an extract that stores a new qvd file in the same directory everyday. The files are called accounts_$(v_todays_date).qvd

Then when I pull the files in the data model my FROM statement is just:

FROM (qvd)

So it pulls in every file in the directory.

This has worked fine so far since I have not needed to add any fields. However, I am in a situation that I do need to add a field to the files going forward. I am wondering if there is a way to keep my current structure and somehow ignore the fact that there is a new field in some of the qvd files. Like something that I can put in the LOAD that says if the field doesn't exist in one of the qvd files just make it null. Is this possible?

7 Replies
adamdavi3s
Master
Master

I hate to say it but does just using this work:

Load *

FROM (qvd)



It depends what you then do with those fields I guess, but you can't be doing much if you're aiming for optimised qvd loads anyway.

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

You can try a loop in your directory like:

MyTable:

Load

  *

Inline [

  ID

];

for each vfile in filelist("directoryName")

concatenate(MyTable)

Load

  *

From $(vfile)(qvd)

;

next vfile

Help users find answers! Don't forget to mark a solution that worked for you!
adamdavi3s
Master
Master

Hmm no that creates a synthetic key... bear with me

adamdavi3s
Master
Master

Yep this resolves the issue I was having with the synthetic key, and actually you don't even need the loop

transactions:

load * INLINE [

TransCounter

];

concatenate(transactions)

load *

from accounts_*.qvd(qvd);

Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

ah, ok great

Help users find answers! Don't forget to mark a solution that worked for you!
Not applicable
Author

What is the purpose of 'TransCounter' in this example? I don't currently have a field like that in my existing qvd files and I am unable to recreate them.

adamdavi3s
Master
Master

hi Matt,

it can be any field from your QVD at all, just replace it with any one. The load inline is just required to create the table so you can then concatenate it