Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
JelleSchuermans
Contributor
Contributor

Looping over different data connections

Hello everyone

I use the exact same datasets, distributed by region. As a result, each region has its own data connection. Now I would like to read in data from different data connections.

Currently in the following way:

SALES: 
LOAD
    Sales,
    Amount,
    ...,
   'regionA'                as DataConnection
FROM [lib://tranformation regionA/Sales.qvd]

Concatenate (SALES)
LOAD
    Sales,
    Amount,
    ...,
    'regionB'                as DataConnection
FROM [lib://tranformation regionB/Sales.qvd]

Is it possible to do this with a loop where I change a piece (region...) in the connection?
I must also clearly indicate from which connection the data comes (regionA as DataConnection) to be used in section access.

Thanks in advance

Labels (3)
1 Solution

Accepted Solutions
JordyWegman
Partner - Master
Partner - Master

Hi Jelle,

Do you know in advance which regions there are? If so, you can try this:

// Add your regions here
Regions:
Load * Inline [
Region
A
B
C
];

For each Region in FieldValueList('Region')
    
    // Just for knowing, doesn't have an impact   
    Trace Load Region: $(Region) ; 

    SALES:
    Load
       *
    FROM [lib://tranformation region$(Region)/Sales.qvd]
    ;

Next Region

 

You don't need a concatenate function while it auto concatenates.

Jordy

Climber

Work smarter, not harder

View solution in original post

1 Reply
JordyWegman
Partner - Master
Partner - Master

Hi Jelle,

Do you know in advance which regions there are? If so, you can try this:

// Add your regions here
Regions:
Load * Inline [
Region
A
B
C
];

For each Region in FieldValueList('Region')
    
    // Just for knowing, doesn't have an impact   
    Trace Load Region: $(Region) ; 

    SALES:
    Load
       *
    FROM [lib://tranformation region$(Region)/Sales.qvd]
    ;

Next Region

 

You don't need a concatenate function while it auto concatenates.

Jordy

Climber

Work smarter, not harder