Find data on relationless tab panel

Hi Guys,
I have just started playing with relationless tab panels and displaying different forms on those tab panels (ala Graham Greensall’s servoy magazine showcase article Worxinfo II: Small Business Solution).
I’ve found these Servoy Magazine tips and articles extremely useful in learning servoy.

I understand that when I place a form into a relationless tab panel, I must write my own find statements. If I hard code (or use a global) field as the right side of the find statement, then the find function works,

Code

forms[currentform].controller.find();
forms[currentform].lastname = ‘Sawyer’;
forms[currentform].controller.search();

The question I have is that to do that I must know the field they are searching on. Is there a way to get the elementName from within a find, so I can substitute the database field based on the field they select, or am I completely up the pole?

Something along the lines of

Code

forms[currentform].controller.find();
var elementName = application.getMethodTriggerElementName();
forms[currentform].elements[elementName] = [whatever is typed into the find field]
forms[currentform].controller.search();

If I could figure out this method, then it wouldn’t matter which form or field they were in for the search, and I wouldn’t have to write a whole bunch of code for the different forms.

Any help pointing me in the righ direction would be really appreciated.
Thanks
Graham

Graham

That is absolutely possible!
This is Servoy…there’s always the ‘ahhhhhh…of course!!’

// gather information about where your user is and what they entered

// first, get the form and element that triggered the method
var eleName = application.getMethodTriggerElementName();
var frmName = application.getMethodTriggerFormName();

// then use those to find the dataProvider name, from the database
var fldName = forms[frmName].elements[eleName].getDataProviderID();

// and use that to get the contents of that dataProvider
var fldContents = forms[frmName].foundset.getRecord(forms[frmName].foundset.getSelectedIndex())[fldName];

HTH