I have several columns that are the same name on each table: user_id(int11), created_by_id(int11), etc.
I currently have a local method to populate these columns such as:
Forms.formname.user_id = 1;
Is it possible to do this with a global method that will not require me to enter a form name with each script?
or
Is there a way to tell the global method which form I currently am in, and to perform the work in that current form?
The idea being that I can have one method to enter this data no matter what form I am in.
Servoy has, under the application node amethod called getMethodTriggerFormName(). This returns the name of the form that triggered your method.
Under the currentcontroller, there is a getName() function, returning the name of the current form.
What you could do in a global method is:
forms[application.getMethodTriggerFormName].user_id = xxxxx;
My experience is that you’re better of using getMethodTriggerFormName instead of currentcontroller.getName, when you use Tabpanels and JSplitpanes thoughout your solution.
If you add the Tabs allready in Developer (so not at runtime) you can give each tab a different name.
As of 2.2RC3 you can retrieve the name of a tab. so, with that, you can do the math.
If you add tabs at runtime, the tabname will be the name of the form on the tab. So, in that case, you just have to store what is shown where yourself. But hey, when adding tabs at runtime, they are relationless anyway, so you have to manage the foundsets as well, so that shouldn’t be an issue.
There is a request out there to have an event that will be triggered when selecting another tab which gets passed as paramaters the old and new TabIndex. dunno if and when it will make it into Servoy.