Calling controls details (name / id / number) in display method?

Hi All,

In a display method (In Form DataSource) is there any way to get the calling controls details(name / id / number).

Thanks in Advance,

Aravindraj S

Can you please explain with an example(in the same\different form)?

Hi Kranthi,

My Requirement is that I have to create dynamic Columns in Grid and fill the values. I have done the following

In Form init() - I have created two dynamic columns in Grid, and asigned one display method for both columns which is written in the same FormDataSource

the code i used to create colunms is

FormStringControl newCon,newcon1;

FormGridControl bGrid;

FormBuildDesign design;

;

design = element.form().design();

BGrid = design.control(‘Grid’);

newCon = BGrid.addControl(FormControltype::String, ‘New Field’);

newCon.dataSource(design.dataSource(‘DataSourceName’));

newCon.dataMethod(‘TestDisplay’);

newcon1 = BGrid.addControl(FormControltype::String, ‘Another Field’);

newcon1.dataSource(design.dataSource(‘DataSourceName’));

newcon1.dataMethod(‘TestDisplay’);

In display() - I have to know out of these two columns which one is calling the method currently. So that I can return the corresponding value

i cannot use seperate display methods because the number of columns i create may vary.

you can get it by using element.selectedControl();

FormControl formControl;

formControl = element.selectedControl();

if (formControl)

formControl.id(); or formControl.name();

Hi Kranthi,

Thanks for the reply.

element.selectedControl() is returning the control which has focus(i.e First control of the form) , but I need to know which control (column) of the grid is calling the display method.

Really appreciate your help.

Thanks in advance,

Aravindraj S

I think you will not be having the callercontrol information in display method and it will only have the selected control information.

I don’t think the idea to return a value based on calling control by using the display method will even work, as the display method can have a single value and the final value will remain in all the controls(as the previous values are not physically bounded to the controls).

If you can provide more information on the requirement, we can try to provide you a better solution.

Hi Kranthi,

My requirement is, I have to show all the rows in a table as columns in grid. If any new row is entered in the table the grid should have new column automatically.

Thanks & regards,

Aravindraj

A, right! You don’t want to use a grid, but a Table control.

Have a look at the tutorial_Form_Table form and see if it works for you.

Although my primary question would be: why do you want this?

I assume you don’t have a lot of rows in the table you want to display?

[edit: ‘suggested solution’ should be this post and not the previous one]

I do the same requirement with you. Did your find how to get ctrl id from its display method or sth else?

Regards