I'm having problems getting the following right.
I have four tables Product, ProductCharacteristic and ProductHasCharacteristic
Product : ProductHasCharacteristic = 1 : many
ProductCharacteristic : ProductHasCharacteristic = 1 : many
I want to show one specific ProductCharacteristic of a Product. If it does not have that characteristic, It is supposed to have a default value (or blanc).
I have managed to set up a TypedList for all Products that have a characteristic. but not to show the default value in case the specific value is not present.
I could set this up using views in SQL and then use a typed view or list in LLBLGen.
E.g.
Define view with name Xxxxxxx:
SELECT x.IdProductHasCharacteristic as IdProduct, y.name as SpecificCharacteristic FROM ProductHasCharacteristic x, ProductCharacteristic y where y.characteristicCode = 6
This gives me a table of the Ids of all ProductHasCharacteristic records together with the Name of the characteristic Iám looking for.
Then the following SQL would give me what I want:
SELECT a.Id, b.SpecificCharacteristic from Product a LEFT JOIN Xxxxxxx b ON a.Id = b.ProductId
Probably there is a better way to do this in SQL, but can this be doen in a typed list?