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

Data Column Associations and one to many relationships

What I found pretty cool a couple of months ago was that if I associated tables using the 'column association' method AND the data had a one-to-many relationship I could sum values without it duplicating the figure BUT if I actually used a join, the figure would duplicate and would affect my calculation.

A few months down the line, without any changes to code and still using the column association method, the figures are now duplicating.

Any ideas as to what the problem could be.

1 Solution

Accepted Solutions
Not applicable
Author

Thank you so much for your response.  I've managed to sort it out.  I have included some code for people that might be interested in analysing the differences between column associations and joins.

1.  Add this code to the editor   2.Then sum on Premium  ...  Total premium is 400 for 2 policies

3.  Now edit and unrem the join  4. The total premium now is 600 for the 2 policies

[POLICY DATA]:
LOAD * INLINE [
    PolicyNo, Premium

    A123, 200

    B456, 200

];

[POLICY ITEM DATA]:
LOAD * INLINE [
    PolicyNo, ItemInsured
    A123, Mazda
    A123, Toyota
    B456, BMW
];


//  LEFT JOIN  ([POLICY DATA]) LOAD DISTINCT * RESIDENT [POLICY ITEM DATA];

View solution in original post

3 Replies
Not applicable
Author

Can you put an example?

Tanks.

Not applicable
Author

Thank you so much for your response.  I've managed to sort it out.  I have included some code for people that might be interested in analysing the differences between column associations and joins.

1.  Add this code to the editor   2.Then sum on Premium  ...  Total premium is 400 for 2 policies

3.  Now edit and unrem the join  4. The total premium now is 600 for the 2 policies

[POLICY DATA]:
LOAD * INLINE [
    PolicyNo, Premium

    A123, 200

    B456, 200

];

[POLICY ITEM DATA]:
LOAD * INLINE [
    PolicyNo, ItemInsured
    A123, Mazda
    A123, Toyota
    B456, BMW
];


//  LEFT JOIN  ([POLICY DATA]) LOAD DISTINCT * RESIDENT [POLICY ITEM DATA];

Not applicable
Author

Thank you so much for your response.  I've managed to sort it out.  I have included some code for people that might be interested in analysing the differences between column associations and joins.

1.  Add this code to the editor   2.Then sum on Premium  ...  Total premium is 400 for 2 policies

3.  Now edit and unrem the join  4. The total premium now is 600 for the 2 policies

[POLICY DATA]:
LOAD * INLINE [
    PolicyNo, Premium

    A123, 200

    B456, 200

];

[POLICY ITEM DATA]:
LOAD * INLINE [
    PolicyNo, ItemInsured
    A123, Mazda
    A123, Toyota
    B456, BMW
];


//  LEFT JOIN  ([POLICY DATA]) LOAD DISTINCT * RESIDENT [POLICY ITEM DATA];