How To Get A List Of All Tables Referenced In Your Solution
Posted: Thu Sep 19, 2013 4:56 pm
It may seem pretty simple - but I've had a couple of people ask me how to get a list of the referenced tables in a large solution because the customer has added a whole bunch of tables that have nothing to do with a particular solution.
This code is compatible with 5.x to 7.x (not optimized for new methodologies in 7.x - but will still run).
INSTRUCTIONS:
1) Make a new form in your solution with no datasource;
2) Make a TEXT form variable called "fv_tables";
3) Put the form variable on your form and make the displayType a TEXT_AREA;
4) Make a button on the form and create a new script called "getTables";
5) Put the code below into the "getTables" function;
6) Launch a client (Smart or Web), navigate to your form and press the button.
Here's the button code:
Hope this helps someone out!
Cheers,
Bob
This code is compatible with 5.x to 7.x (not optimized for new methodologies in 7.x - but will still run).
INSTRUCTIONS:
1) Make a new form in your solution with no datasource;
2) Make a TEXT form variable called "fv_tables";
3) Put the form variable on your form and make the displayType a TEXT_AREA;
4) Make a button on the form and create a new script called "getTables";
5) Put the code below into the "getTables" function;
6) Launch a client (Smart or Web), navigate to your form and press the button.
Here's the button code:
- Code: Select all
function getTables(event) {
var curFormName = controller.getName();
var formNames = forms.allnames.sort();
var tableNames = [];
var curForm, i, frm;
for(i=0; i< formNames.length; i++) {
curForm = formNames[i];
frm = solutionModel.getForm(curForm);
if(tableNames.indexOf(frm.dataSource) == -1) {
tableNames.push(frm.dataSource)
}
}
fv_tables = tableNames.sort().join("\n");
}
Hope this helps someone out!
Cheers,
Bob