Im currently working on a function, in which i need the ability to loop through fields contained within tabs on a tab panel and obtain their names or index.
We are using this information to construct and parse a sql string from user data entry.
So we need to know the following
a. if any data is present, what is it and also the field name
and
b. if data is present, what data type is it
I know the names could be hard coded but we need to future proof this as much as possible.
If anyone could offer some help or example code on this it would be much appreciated.
After the DataType info the first item appears to be the ‘name’ property for the element. The last is the data in the element on the live form.
Q. Why in some of the rows are there two references the same (i.e. DataCheckBox[fc_surface_preparation_required:fc_surface_preparation_required:0]), yet in some others there is only one reference? Thought at first this was the ‘name’ and the ‘dataprovider’ properties respectively, but others have no second reference? They have a ‘Null’ as in row 4 above yet all have both names and data providers?
Q. Why does this code skip elements where the ‘name’ property is empty? Surely it should still populate the DP name of the element? I note (obviously) that I’m using the ‘.allnames’ method but my expectation would be that the element would be shown as existing with a null name - or is that just dumb?
Q. Is there a method that can list all elements that ‘don’t’ have a ‘name’ property populated?
Zuke:
if any data is present, what is it and also the field name
use ‘alldataproviders’ from the formobject and iterate over them.
you can check if any value is there with: forms[$form].alldataproviders ** > Zuke: > b. if data is present, what data type is it to retrieve the type you could do something like this: * _databaseManager.getTable(forms[$form].foundset).getColumn(forms[$form].alldataproviders*).getTypeAsString()*_ _*_ So this is a different approach: instead of iterating the elements you have to iterate the dataproviders. I think this is the easiest way to get to your goal. Hope this helps