I am trying to create a global method using getMethodTriggerElementName with the following code:
//user clicks on a record within a portal with a relationshp based on a given date and then clicks on a popup menu to change the date of the record
var date = application.showCalendar();
date.setHours(0,0,0,0);
var relationship = application.getMethodTriggerElementName();
var shiftdate = relationship.concat(‘.shift_date’);
shiftdate = date;
forms.schedule_entrys.controller.saveData();
The form triggering the event is “schedules_to_schedule_entrys_sat1”
I want to generate “schedules_to_schedule_entrys_sat1.shift_date” and then set it equal to “date”.
If I literally write
“schedules_to_schedule_entrys_sat1.shift_date = date”
the method works fine but I want the method to work programmatically so that I can use it across mutiple portals.
“shiftdate” appears to generate the correct string expression but it doesn’t appear to act as a field (ie. shiftdate does not become equal to “date”)
You create the shiftdate variable within the scope of the method on your form (or without var within your form).
It therefore only lives in those locations. Alternatively you should call the method to do what you want it to do…
I assumed from your reponse that I should set up a global variable to hold the name of the field that I want to set equal to “date” (which I did) so now
gshiftdate = “schedules_to_schedule_entrys_sat1.shift_date” as a text string,
but how do I use the contents of gshiftdate to set the specified field, schedules_to_schedule_entrys_sat1.shift_date = date.
I remember seeing something about an EVAL function in Servoy Magazine … this function allows run-time string replacement similar to other environments. Check out http://www.servoymagazine.com/home/2006 … micki.html or else try using [var] substitution.