I have a form that is attached to one table in my database but need a value from another table to perform a calculation. how do i write a query to that other table in the same database while the form is still attached to the other table.
Did you consider creating a relationship between the two tables, and displaying the value through that relationship?
If there is no direct relationship then perhaps harvesting the value through getDataSetByQuery is a better bet?
thanks, can i get a code sample to access it through the relationship please?
Create your relationship TableA.your_fieldNameA = TableB.your_fieldNameB as (say) ‘tableA_to_tableB’
In your form place a field on the form and for its datasource use tableA_to_tableB.yourRelatedColumnName
This available in the drop-down where you are asked to determine the data source for a field (in properties) - you should be able to see your relationship and select it, then select the column from it. If the relationship is not visible in this drop-down it usually means that Servoy is expecting a global relationship. Sounds more difficult than it is so just think it through.
This should display your data from the second table.
You may need to use a global variable as one side of your relationship depending on what the link is you want. Search the forum for creating a global relationship. But once you have the relationship use the code above to display it (add your own table and column names of course ;-})
Best of luck
thanks, will try it