Can we use dot in form object names?


I see that you use a dot in form object names ;example ‘’ in 4D Pop Xliff Pro.
is this a safe way to proceed with future developments?

I already saw that you use also dot in variable names ; it was also surprising for me…

Maybe this is a hacky trick :wink: When you use same string in datasource and in objectname, than when you know/get objectname you know datasource too. Can be workaround for missing objectGetPointer for datasource type expression/object. ObjectGetName(current) returns current objectname and when datasource is same then you can assign to datasource.object a value…So why not named a object “Form.student” same as datasource when it is wished.

Hi Bernard and Lutz,

Not a hack, maybe a premonition :wink:
To be serious, it was, for me, an elegant and more readable way of naming widgets. I don’t know if I won’t have to change this habit in the future. I don’t think so, but we are not sure of the inventiveness of the 4D development team :wink:

For variable names, I tried a long time ago to use the dot in their names… and for methods too! But I did not persevere and fortunately because it was obviously not a good idea.

For information, if you run a structure check with the CSM, the dots found in the variable names and method names are pointed.

Use a dot in a form object name is a very good idea for me and I did not dare to do until now.

A good example of use :
I have 2 listboxes in a form, ie ‘choiceList’ and ‘displayList’
In each listbox, I must name ‘currentElement’ => bing ! I have twice same name.
Well I choosed ‘clCurrentElement’ and ‘dlCurrentElement’ but ‘Form.choiceList.currentElement’ and ‘Form.displayList.currentElement’ for the variables.

With dot in names, I will use names ‘choiceList.currentElement’ and ‘displayList.currentElement’.
More elegant and practical.
Lutz, I won’t put Form in the names…

1 Like

I also use dots on Form Object names as a “hack” to get he Object’s value. However, it is not perfect.
Now you’ve bound your UI/View/Presentation layer to your data layer. Not good, and almost guaranteed to cause issues at some point in the future. If you change your data description you may have to change your UI management code. But even worse, what if I have more than one Form Object bound to the same Property? What do you name them now?

I agree with VDL that using the dot in variable names is a bad idea and may, in the long run, cause confusion between ‘variable name’ and ‘data access’ of the variable.
If you want to use a ‘hack’, nothing prevents you from starting with the name “dotMyVariable” and replacing the “dot” with “form”. (just one of many ideas)

It must not be strict same content in datasource and in objectname!
Create a Form.meta to store there all meta-infos about the form and about all form-objects.
You can build in this meta your own classes and groups…what ever you need…
Only a abstract example, objName is “#meta#.myTxtInputFields.#formobj#.field.#1
can be translated to “Form.field”. Putting a number at the end make name unique in form and you can use Form.field expression multibel times in form for different formobjects.
But this is hacky and not a clean solution ;-)…You need a rule-set how to build your objNames, but i know when 10Developers works 10Years on one DB, than they get 500.000 FormObjects and not realy all named correct…So namingConventions good, but it is not so good idea too have a too complex nameConvention and too must represent the datasource in name is maybe a start into hell :slight_smile:

Hi Lutz. I agree with everythigng you say here, and I’ve been programming that way for a long time. I wrote a MVC style Form/Data manager back in v13, and it’s been working great ever since. However, it relies on using the Name of the Form Object as a reference to the underlying data model, which is why I know what a pain it can sometimes be to have your data layer bound to your UI layer. Since the arrival of the Form command there’s potentially a much better way, which decouples the data and UI layers. But, until we have some way to get/set a Form Object’s value based on its Name I have to stick with what I have.