10-18-2022 01:15 PM - last edited on 05-02-2023 10:22 AM by JackLacava
I am trying to write a BR to update the Global Time within the OS application. I see API function to get globaltime (BRApi.Workflow.General.GetGlobalTime). However, I don't see one for setting/updating global time. Is there a API to update the Global Time?
I even searched the tables in the Database to see if I can manually update the record within a table, but didn't come across the table that contains the Global Time.
Is there a way to update the Global time based on the system time?
Thanks,
10-20-2022 02:31 PM
The table containing Global Time and Global Scenario is AppProperty, in the records with Name "GlobalTime" and "GlobalScenario". There is no public Api for it, as far as I can see, so I wouldn't recommend it changing it directly in the database without restarts, but it might work.
10-20-2022 06:01 PM
I added this code to a Data Adapter:
UPDATE
AppProperty
SET
TextValue = '2022M10'
WHERE Name = 'GlobalTime'
After executing the query, the value in the AppProperty table is changed, but the value in the POV pane is not. Log off / log on is needed for the change to take effect.
01-10-2023 03:32 AM
Please try using AppProperties:
BRApi.Utilities.GetApplicationProperties(si).GlobalTime = "2022M10"
This worked for us. Hope it helps :).
Best,
02-03-2023 02:42 PM - edited 02-03-2023 05:16 PM
I tried with this example; however, the Global time is only updated during the user session. The update is only in memory but doesn't update the database.
Did you have any similar issue?
Thanks,
02-06-2023 04:17 AM
I didn't face any such issue. Have you tried refreshing application?
FYI, I've been triggering Extender business rule via DM step and scheduled via Task scheduler.
Best,
02-06-2023 07:40 AM
Yes, I refresh the application and the variable is updated correctly. However, after logging out and entering a new user session, it returns to the previous value.
Thanks,
02-28-2023 09:42 AM
Hey,
I tested it again in lower environment and you were right it doesn't update correctly.
I checked with OneStream support and BRApi.Utilities.GetApplicationProperties(si).GlobalTime will only hold cached values. It won't update it at the DB level.
Now, I'm also moving to SQL solution suggested by bilbrandon.
Thanks,
Gaurav
08-02-2023 08:44 AM
Hi Gaurav,
Even after using the SQL query, the same was not reflected in the UI. Do you know how we can achieve that?
Thanks,
Pragyanshu
09-08-2023 12:04 PM
I have used below SQL code to update the Global time but is not updating and also written BR but that is also not working out can one pls help me on this.
SELECT DISTINCT
CASE WHEN Textvalue='2023M5' then '2023M6'
End as Textvalue
From AppProperty