getColumnNames including calculations

Questions and answers on designing your Servoy solutions, database modelling and other 'how do I do this' that don't fit in any of the other categories

getColumnNames including calculations

Postby developers10 » Tue Mar 07, 2017 10:19 am

Hi,

I want to get all the columnNames of a table, including the calculations (non-stored)
The calculation-fields are not returned by the JSTable.getColumnNames().

Any idea how to do this?

Thx
developers10
 
Posts: 31
Joined: Thu Feb 23, 2017 5:33 pm

Re: getColumnNames including calculations

Postby patrick » Tue Mar 07, 2017 10:31 am

The JSTable object represents the table in the database and that doesn't know about calculations (except stored ones). If you want to get calculations defined, you need to use the solutionModel. Try this

Code: Select all
var dsNode = solutionModel.getDataSourceNode(datasource)
var jsCalcs = dsNode.getCalculations()


jsCalcs is a JSCalculation array, so to get the names you have to walk over the array and call getName() on each.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany


Return to Programming with Servoy

Who is online

Users browsing this forum: Google [Bot] and 8 guests