Hello,
there are a number of situations where it would be helpful to find out more about the foundset you sit on. I have seen that in Servoy 3 you can unrelate a foundset. My problem is now that I need the foreign key used in a foundset but the foundset is still empty, so I cannot check a record. Now I do something like this (if I know the foundset is related) to find the foreign key:
databaseManager.startTransaction();
foundset.newRecord();
var vForeignKey= foreign_key; // grabbing the foreign key filled by Servoy
databaseManager.rollbackTransaction();
Since Servoy knows all this about its foundset, I think it’d be helpful if we could access this information in a better way then creating “dummy” records.
So my idea is this:
- foundset.getRelation() returns a JSRelation object (under the databaseManager) or null if the foundset is unrelated
- a method getRelations() in the relations node also allows to retrieve all relations accessible from a certain form as JSRelations array
In the databaseManager, there could be a
databaseManager.getRelation(String modulname, String relationname)
to return all relations as JSRelation. The JSRelation class under the databaseManager then offers
- getColumnsLeft(): returns a JSColumn array containing all columns used on the left side of a relation
- getColumnsRight()
- getOperators(): returns a String containing the operators used in each condition
- getValues(): returns an Object containg all the values, the relation is using from the perspective of a form
- getDefinition(): returns an Object that contains for each condition an array like [columnLeft][operator][columnRight]
Would that be possible?