How to get field value of Solution Model Field

Hi All,

I have a form (Table View) in my solution:
var _form1 = solutionModel.getForm(‘frm_form1’);

Then I added a field with the SM:
var _field1 = _form1.newTextField(‘person_name’, 100, 100, 140, 20);

(person_name is a column in a dataset)

Then I gave the field a name:
_field1.name = ‘person_name’;

Then I need to get the person_name of the selected record of the form.

I tried doing:
application.output(forms.frm_form1.foundset.person_name)

I get a null value.
Can someone help me with this?

Thanks in advance!

Regards,
Hareendra

hareendra:
Then I need to get the person_name of the selected record of the form.

I tried doing:
application.output(forms.frm_form1.foundset.person_name)

I get a null value.
Can someone help me with this?

Are your sure the foundset on that form is correct and you’re on the correct selected record?

Because this:

forms.frm_form1.foundset.person_name

is pointing directly to the column ‘person_name’ in the foundset, which is taken direcly from the connected table (I assume you did connect a table to ‘frm_form1’?!)
That has absolutely nothing to do with the field/fieldname you have put on your form.

Sorry for the confusion.
No I did not map my form to a table. I created a form without a table. then using the solution model, I created a data source. I will give the entire code:

var _sql = "SELECT person_name FROM table1;

var _dataset = databaseManager.getDataSetByQuery(globals._active_server, _sql, null, -1);

if(_dataset.getMaxRowIndex() > 0) {
elements.tab1.removeAllTabs();

var _data_source1 = _dataset.createDataSource(‘data_source1’,[JSColumn.TEXT]);

var _form1 = solutionModel.getForm(‘frm_form1’);

var _field1 = _form1.newTextField(‘person_name’, 100, 100, 140, 20);
_field1.name = ‘person_name’;

Then I need to get the person_name of the selected record of the form.

I tried doing:
application.output(forms.frm_form1.foundset.person_name)

I get a null value.

Regards,
Hareendra

Hi Hareendra,

You are forgetting to put the datasource on the form like so:

var _data_source1 = _dataset.createDataSource('data_source1',[JSColumn.TEXT]);
var _form1 = solutionModel.getForm('frm_form1');
_form1.dataSource = _data_source1;

Hope this helps.

Yes, Roclasi is right… that are my thoughts as well…

I stand by my previous post: foundset.person_name should return the correct value.
Something else is wrong.