tmannais
21st February 2019, 08:50
As the title says.
I have been finding a way to make sessions/reports trigger my function (it can be written in any way possible) on started.

For example,
User starts a session. Before the session opens up, it runs my function first.
The same goes for report.
Bonus: If Extensions are possible then I am also curious about that too.

What I am looking for is to have a central function that is written only once and kept in one place but will be triggered every time any mentioned component is run.

Ajesh
21st February 2019, 10:11
Do you mean for a specific session or all the sessions?

If for a specific session or , in case if its customized, then you can write it in before.program section for session and before.report section for report.

In case if its a standard Session, then we will have to write in an Extension,before any specific action(that depends on your requirement)

tmannais
21st February 2019, 10:14
I mean for all sessions/reports/extensions.

Ajesh
21st February 2019, 12:25
What exactly you want to achieve running that function?

I mean you can write a 3GL and put it in a daily job also. That would spare you from running it through every session.

tmannais
21st February 2019, 12:30
I have made a table containing data for session codes, report codes, and extension codes along with their expiry date.
What I want to do with this functionality is that when any session, or report, or extension is started, I will get the code of that component and check in the expiry table.
If the component is expired then I will terminate the execution using stop().
The only part that I am not able to do is this -- to call a function (middleware-like) before starting any mentioned components.

Ajesh
21st February 2019, 13:01
You have to Run it for Customized Sessions only or with Standard ALso?

tmannais
22nd February 2019, 03:32
It can be only customized components(sessions/reports/extensions) because I want the user to be able to work on the standard when the customized ones are expired.

Ajesh
22nd February 2019, 09:48
Then you will have to do it manually. At best you could list out all the DALs for your customized sessions and in those DALs, in before.open.object Hook, you could write that check.

NPRao
22nd February 2019, 18:44
I have made a table containing data for session codes, report codes, and extension codes along with their expiry date.
What I want to do with this functionality is that when any session, or report, or extension is started, I will get the code of that component and check in the expiry table.
If the component is expired then I will terminate the execution using stop().
- You already have that information (expired, created/modified time) in the standard tools tables for Sessions, scripts, Reports etc.
- It sounds like you are trying to replicate the Standard 4GL engine behavior.
It can be only customized components(sessions/reports/extensions) because I want the user to be able to work on the standard when the customized ones are expired.
- You are better off creating 2 VRC layers - operations (derived from stnd - update VRC) and cust (customizations) if you like to have the isolation from each other.
- Alternatively, you should consider deleting the custom component than expiring it so the Standard program picks up the standard component when there is no customized component.

tmannais
25th February 2019, 03:33
- You already have that information (expired, created/modified time) in the standard tools tables for Sessions, scripts, Reports etc.
- It sounds like you are trying to replicate the Standard 4GL engine behavior.

- You are better off creating 2 VRC layers - operations (derived from stnd - update VRC) and cust (customizations) if you like to have the isolation from each other.
- Alternatively, you should consider deleting the custom component than expiring it so the Standard program picks up the standard component when there is no customized component.

Thanks for the suggestions. I will try.