waldo1001 / crs-al-language-extension

Make working with the (Dynamics NAV / 365) AL Language easier and more efficient.
MIT License
34 stars 43 forks source link

Feature suggestion: split affix in two parts #209

Open TheDenSter opened 2 years ago

TheDenSter commented 2 years ago

In light of the current way of looking at affixes, partners register a company affix with MSFT, let's call that the 'base affix', let's say I am the ABC company with the affix ABC. Then, they are advised to create app specific affixes with the base affix plus a number of digits for the app. So if I have app 01 and app 02, I would have affix ABC01 for the first and ABC02 for the second. So far so good if these apps are independent, you can just set up the affixes in each app and you're good.

Let's say I have a 'Widget' table in app01, this now gets renamed to 'WidgetABC01'. Let's say I have a 'Gadget' table in app02, that is renamed to 'GadgetABC02'. All possible with the CRS tool.

Now let's say I want to add a dependency to app01 in app02, and I want to extend the Widget table. Since the table is called 'WidgetABC01', and the affix in app02 is ABC02, then my tableextension will be renamed to 'WidgetABC01ABC02'. Technically all good, but really you don't need to repeat the app01 tag to make it unique, it could just be called 'WidgetABC02' and that would work fine. Even if you then add app03, you could extend the Widget table again and name that 'WidgetABC03'.

So what I do currently is disable the rename in the OnSave, because I don't want the 'repeated' affixes. I do use the reorg command to set the name and move the object into the src folder, but I manually change the name from there to just have one affix.

So, my suggestion is to split the affix up into a 'base affix' and an 'app affix', and then have those as elements for the naming pattern.

waldo1001 commented 2 years ago

Hm, I see what you mean.

What if I create yet another setting: CRS.RemoveAffixFromExtensionObjectName which would be an array of strings .. which you would be able to set up like

{
   "CRS.RemoveAffixFromExtensionObjectName": ["ABC01","WLD","DNSTR"]
}
TheDenSter commented 2 years ago

How would it work, would it strip the affix from the name and then add the current to the name?

So it would

Yes that would work I think. Would be a handy tool for re-using objects too that way

waldo1001 commented 2 years ago

Indeed, that's what I have in mind.. . Only for extension objects:

Yes that would work I think. Would be a handy tool for re-using objects too that way

hm, didn't think of that ;-)