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

Create the QVDs based on the Value availability in Field

HI All,

Need help!!!!

I have created the final Data and now I need to create the QVDs based on this data. I have one Field name: Region. So now what I want if the region has NA (North America) then it will create the QVD on the NA region otherwise it will not create its QVD.

Example:

Tbl1:

LOAD * INLINE [

  Region, Text

  NA, Jan

  SE, Feb

  NA, Mar

  NA, Apr

  DACH, Dec

];

So what I want:

If Region='NA' Then

Store Tbl1 where Region='NA' into [Path] (Qvd);

Endif

If Region='SE' Then

Store Tbl1 where Region='NA' into [Path] (Qvd);

Endif

Regards,

Pawan

1 Solution

Accepted Solutions
marcus_sommer

In this case would be a loop through the field Region easier. I mean something like this:

for i = 1 to fieldvaluecount('Region')

     let vRegion = fieldvalue('Region', $(i));

     StoreRegion:

     noconcatenate load * resident Example where Region = '$(vRegion)';

     store StoreRegioninto [Path\vRegion.qvd] (Qvd);

next


- Marcus

View solution in original post

4 Replies
marcus_sommer

The store-statement has no option to apply a where-condition. You will need to filter your wanted values in previous loadings like:

NA:

noconcatenate load * resident Example where Region = 'NA';

store NA into [Path] (Qvd);

noNA:

noconcatenate load * resident Example where Region <> 'NA';

store noNA into [Path] (Qvd);


- Marcus

Not applicable
Author

Hi Marcus,

Thanks for replying.

I will insert these line for every region:

NA:

noconcatenate load * resident Example where Region = 'NA';

store NA into [Path] (Qvd);

But if any Region is not available in the table then I will not want that region's QVD to be generated.

So If NA region data if not there in the table then it should not be execute the "store NA into [Path] (Qvd);" line.

Is it possible?

Thanks & Regards,

Pawan

marcus_sommer

In this case would be a loop through the field Region easier. I mean something like this:

for i = 1 to fieldvaluecount('Region')

     let vRegion = fieldvalue('Region', $(i));

     StoreRegion:

     noconcatenate load * resident Example where Region = '$(vRegion)';

     store StoreRegioninto [Path\vRegion.qvd] (Qvd);

next


- Marcus

Not applicable
Author

This is exactly what I want. Thanks a lot.

Regards,

Pawan