4

I want to create two tables in qlikview; one called Station and one called Trains. I had planned to apply a QUALIFY statement so any matching fields between the two tables are not confused.

However, the data for each table are loaded in from multiple spreadsheets using a FOR EACH ... loop. This means that by qualifying the load, multiple tables are created called: Station-1, Station-2, Station-3, etc. with similarly sequential field names.

Is there a way I can semi-QUALIFY my load statement, so that all the all fields are preceeded with either "Station." or "Trains." without having a different name applied to data coming from each individual spreadsheet?

Hal Baggot
  • 124
  • 2
  • 14

2 Answers2

3

Concatenate your station tables before qualifying the column names.

Something like the following:

[Station]:
  LOAD [col1], [col2]
  FROM [Station1.xls]

[Station2]:
  CONCATENATE (Station)
  LOAD [col1], [col2]
  FROM [Station2.xls]
George
  • 36,413
  • 9
  • 66
  • 103
1

I would try to avoid qualify in general. For many scenarios, common fields among different tables tells you something about the date, where Qualify helps you ignore.

What sort of association do you want between the trains and station tables? Make sure you understand QVs association engine as well as the fields you want to interrelate.

Also - Concatenate will do a nice looking union as long as the field names are identical. In fact, it will automatically concatenate if there exist the same number of fields with the same names. If this is not the case, you're probably better off setting variables using if() statements to combine common fields with different names.

i.e. IF Match('$(vFieldName)', 'FUELCODE' ) then SET vFuel = 'FUELCODE'; ELSEIF Match('$(vFieldName)', 'FLDCD_TR' ) then SET vFuel = 'FLDCD_TR'; ENDIF

Best, David

  • In this case, I wanted no association between trains and stations. In an ideal world it would have bene two separate dashboards but having both data sets in one application was less confusing for the end user (and required fewer licences) – Hal Baggot Jan 30 '15 at 09:26