DDL Align JOINs and ASSOCIATIONs with new cardinality syntax
Hi Jaime,
thanks a lot for reporting this bug! That's odd, I thought I had covered this syntax… but it seems that ABAP cleaner wrongly expects the source name already after the "to" keyword. Will look into it!
Here's some (copyable and obfuscated) code (mostly for myself to try it out and create tests :-)
define view entity I_AnyView
as select from any_source
association of one to exact one I_OtherView as _Other on $projection.OtherField = _Other.OtherField
association to parent I_ParentView as _Parent on $projection.AnyField = _Parent.AnyField
association of one to one I_ThirdView as _Third on $projection.OtherField = _Third.ThirdField
association of exact one to exact one I_FourthView as _Fourth on $projection.FourthField = _Fourth.FourthField
association of one to one I_FifthView as _Fifth on $projection.FifthField = _Fifth.FifthField
{
key AnyField as AnyField
}
Kind regards, Jörg-Michael
Hi Jaime,
actually, apart from fixing this bug, it's quite a nice idea to align those "to" keywords if the cardinality is textual, so I added this as an option to the "Align JOINs and ASSOCIATIONs" rule:
With the next release, this will result in:
By deactivating this option, you get:
You can combine it with the "Align ASSOCIATIONs together with JOINs" option (which is deactivated by default), but that might be taking things too far:
Kind regards, Jörg-Michael
Hi Jörg-Michael,
Nice, thank you!
Just one very rare case, how it works with a combination of both syntax?
association [0..1] to I_Country as _Country1 on $projection.Country = _Country1.Country
association of one to one I_Country as _Country2 on $projection.Country = _Country2.Country
Hi Jaime,
as of now, if there is at least one association with textual cardinality, all the "to" keywords get aligned, even those with numeric cardinality:
Kind regards, Jörg-Michael
Hi Jaime,
sorry to keep you waiting for so long – this should now be part of version 1.21.2!
Kind regards, Jörg-Michael
Hi Jörg-Michael
?ve been cheching and it seems that it isn't align correctly when there are spaces between the association text:
Perhaps it is not just aling the "TO" keyword, it's about aling all the keyword in the textual cardinality:
| Source | to | Association |
|---|---|---|
| exact one | to | exact one |
| exact one | to | many |
| exact one | to | one |
| many | to | exact one |
| many | to | many |
| many | to | one |
| one | to | exact one |
| one | to | many |
| one | to | one |
Final result could be something like this:
association [0..1] to /RHP/R_ValueSet as _ValueSet on $projection.ValueSet = _ValueSet.UUID
association of exact one to exact one /RHP/R_ValueSet as _ValueSet on $projection.ValueSet = _ValueSet.UUID
association of exact one to many /RHP/R_ValueSet as _ValueSet on $projection.ValueSet = _ValueSet.UUID
association of exact one to one /RHP/R_ValueSet as _ValueSet on $projection.ValueSet = _ValueSet.UUID
association of many to exact one /RHP/R_ValueSet as _ValueSet on $projection.ValueSet = _ValueSet.UUID
association of many to many /RHP/R_ValueSet as _ValueSet on $projection.ValueSet = _ValueSet.UUID
association of many to one /RHP/R_ValueSet as _ValueSet on $projection.ValueSet = _ValueSet.UUID
association of one to exact one /RHP/R_ValueSet as _ValueSet on $projection.ValueSet = _ValueSet.UUID
association of one to many /RHP/R_ValueSet as _ValueSet on $projection.ValueSet = _ValueSet.UUID
association of one to one /RHP/R_ValueSet as _ValueSet on $projection.ValueSet = _ValueSet.UUID