Relationship based on variable

Maybe it’s a bit of a newbie question and also very impossible, but is it possible to create a relationship based on a variable? :?:

It is possible to create a relation based on a global, which you can have acces on, on every form, alsco called: global relations.

Hope this helps

Thanks HJK, but I allready did that. It’s sometimes more handy to create a temporary relation in a method between variables, therefore my question…
:wink:

Is there any chance this might change in the future? I was also wanting to define a relation on a form based on a form variable.

Thanks,
Corey

Yeroc:
Is there any chance this might change in the future?

Why would you think that ?
I can’t look into the future but the fact that it’s been in the product for over 6 years makes it doubtful that they will (drastically) change it.

Sorry, I guess I mis-read the messages above and thus my question wasn’t clear. I was wondering if a future release might allow relations to be defined against a form variable rather than just a global variable. My reasoning behind preferring this in some situations is that the relation is only needed on a single form so it would be nice to avoid adding it as a global.

Corey

Hi Corey,

You can always file a feature request for this in Servoy’s support system.

Do realize that a servoy relation based on a global is nothing more than a query with a filter, not a true join. It translates to “SELECT pk FROM table WHERE column = myGlobalValue”.
So as a workaround you could do exactly that. Simply use SQL in the controller.loadRecords() like so :

var _sQuery = "SELECT pk FROM table WHERE column = ?";
forms.formInMyRelatedTabpanelButWithoutAnActualRelation.controller.loadRecords(_sQuery, [myFormGlobal]);

Assuming you want to load a form in a tabpanel that is :) .

Hope this helps.

Yes, that was my backup plan. Thanks.

Corey