0

I have a simple load statement:

LOAD FIELDA,
     FIELDB,
     FIELDC,
     FIELDD,
     FIELDE
FROM
[C:\Users\XXX\data.QVD]
(qvd);

This loads all the data fine.

If i add an expression into a straight table it gives me the concatenated field:

 concat(FIELDA&'.'&FIELDB&'.'&FIELDC&'.'&IF(Isnull(FIELDD), '0', FIELDD)&'.'&IF(Isnull(FIELDE), '0', FIELDE)) as MERGED

This works, however if i try and add a concatenated field from the load statement i get an error:

LOAD FIELDA,
     FIELDB,
     FIELDC,
     FIELDD,
     FIELDE,
     concat(FIELDA&'.'&FIELDB&'.'&FIELDC&'.'&IF(Isnull(FIELDD), '0', FIELDD)&'.'&IF(Isnull(FIELDE), '0', FIELDE)) as MERGED
FROM
[C:\Users\XXX\data.QVD]
(qvd);

Invalid expression

1 Answer 1

3

The concat function is an aggregation function so it wants a group by to know what to do, hence the Invalid expression error. In the front end the dimension you choose for the chart serves that purpose.

If you just want to concat the fields line for line just remove the concat function.

FIELDA&'.'&FIELDB&'.'&FIELDC&'.'&IF(Isnull(FIELDD), '0', FIELDD)&'.'&IF(Isnull(FIELDE), '0', FIELDE) as MERGED

The actual use of the concat function would be something like this, run it and see the difference between MERGE and MERGE2;

A:

LOAD * INLINE [
    FieldA, FieldB,FieldC
    1, 2,1
    1, 0,1
    2, 9,1
    2, 4,1
];

B:

load FieldA,     
     concat(FieldB,'|') as MERGE     
Resident A
group by FieldA; 

C:

load FieldA,
     FieldB,
     FieldC,
     FieldA&'.'&FieldB&'.'&FieldC as MERGE2
resident A;

drop table A;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.