Martin Yergeau Posted June 21, 2021 Share Posted June 21, 2021 I dont see any problem. The only issue that I can see is that each time that the profile will be invoked, then the TABLE file will be executed with chances that the global variable will change, which this, can become an issue depending how and where this variable is used Link to comment Share on other sites More sharing options...
David Beagan Posted June 21, 2021 Share Posted June 21, 2021 The code gets executed with every request whether the user needs &&DATA_AS_OF_DATE or not. Try to minimize the overhead of setting the global variable. If it meets your requirements, you could use global variables value from a previous request in the same session. Check for its value to avoid HOLD and -READFILE. -IF &&GGDATE.EXISTS THEN NOTF; TABLE FILE GGSALES SUM MAX.DATE AS 'GGDATE' ON TABLE SET ASNAMES ON ON TABLE HOLD AS GGDATE END -RUN -DEFAULTH &GGDATE = ' '; -READFILE GGDATE -TYPE READFILE executed. -SET &&GGDATE = &GGDATE; -NOTF -TYPE &|&|GGDATE = &&GGDATE If &&DATA_AS_OF_DATE has the same value for everyone throughout the day, you could create the hold file once per day with ReportCaster. Then just do the -READFILE of the already existing HOLD file. Link to comment Share on other sites More sharing options...
Debra Waybright Posted June 21, 2021 Author Share Posted June 21, 2021 @david.beagan The date value gets set once a day for everyone so #2 sounds worth trying. Thanks. Link to comment Share on other sites More sharing options...
Debra Waybright Posted June 21, 2021 Author Share Posted June 21, 2021 Has anyone used a TABLE request to set a global variable in the edasprof.prf Im thinking about doing something like this, but wondered what pitfalls I might encounter SET HOLDLIST = PRINTONLY SET ASNAMES = ON TABLE FILE ETL_PROCESS_LOG SUM MAX.DATA_DATE AS DATA_AS_OF_DATE WHERE PROCESS_NAME EQ schedule_DAILY_LOAD WHERE PROCESS_EVENT_NAME EQ End ON TABLE HOLD AS HOLD_MAX_DATE END -RUN -READFILE HOLD_MAX_DATE -DEFAULTH &DATA_AS_OF_DATE=; -SET &&DATA_DATE = EDIT(&DATA_AS_OF_DATE, 99/99/9999); Thanks in advance for sharing your knowledge and experience! Deb Link to comment Share on other sites More sharing options...
Warren Hinchliffe Posted June 22, 2021 Share Posted June 22, 2021 Another option would be to use "Paths to be executed on user Sign-in (IBI_SIGNIN_PATHS)"set in the admin console. It get executed on login and can point to a fex in the repository or on the server. So only one execution. Link to comment Share on other sites More sharing options...
Toby Mills Posted June 23, 2021 Share Posted June 23, 2021 Thats cool @warren.hinchliffe - I never noticed that setting. Link to comment Share on other sites More sharing options...
Warren Hinchliffe Posted June 23, 2021 Share Posted June 23, 2021 I think its been around quite a while, but in a different form. Remember using something like it in the old MRE days Link to comment Share on other sites More sharing options...
Debra Waybright Posted June 23, 2021 Author Share Posted June 23, 2021 I was not able to get the Paths to be executed option to work. I also realized that the date can change during the day, so I thought it best to just add my original code to the edasprof.prf and that seems to be working as we need it to. Thanks everyone! Link to comment Share on other sites More sharing options...
Pawan Vuppala Posted June 23, 2021 Share Posted June 23, 2021 Hey guys, I have a similar requirement to conditionally enable OPSYSCMD in a user profile. I tried to have a Launch fex to SET this &&DEPLOY value but that did not work or take effect in the profile. Logically it should have enabled DOS commands and enabled OPSYSCMD but it gives me the standard SYS COMMANDS DISABLED error -*This is the launch fex -SET &&DEPLOY=Y EX mainfex.fex -* This is my mainfex DOS DIR -* This is the user profile SET OPSYSCMD=OFF -IF &&DEPLOY EQ N THEN GOTO SKIP_DOS; SET OPSYSCMD = ON -SKIP_DOS Link to comment Share on other sites More sharing options...
David Beagan Posted June 23, 2021 Share Posted June 23, 2021 Do you have a semi-colon at the end of your -SET Im thinking that you cant SET OPSYSCMD=ON after you have SET OPSYSCMD=OFF Link to comment Share on other sites More sharing options...
Pawan Vuppala Posted June 24, 2021 Share Posted June 24, 2021 Im changing it a bit, in user profile but still not quite there. Not sure why its giving me such a hard time to conditionally. What am I missing Please share your thoughts! -DEFAULTH &&OPSYALLOW =N ; -SET &P = IF &&OPSYALLOW EQ Y THEN ON ELSE OFF ;` SET OPSYSCMD = &P Link to comment Share on other sites More sharing options...
David Beagan Posted June 24, 2021 Share Posted June 24, 2021 You code has a backward quote mark at the end of the -SET line. I dont think -DEFAULTH works with global (&&) vars. Maybe just use &OPSYSALLOW single amper. Link to comment Share on other sites More sharing options...
Pawan Vuppala Posted June 24, 2021 Share Posted June 24, 2021 Thanks David, I tried with local variable as well no luck. I dont understand your commend about backward quote, seems fine to me. -DEFAULT &OPSYALLOW =N; -SET &P = IF &OPSYALLOW EQ Y THEN ON ELSE OFF ; SET OPSYSCMD = &P Link to comment Share on other sites More sharing options...
David Beagan Posted June 24, 2021 Share Posted June 24, 2021 pawan.vuppala: I dont understand your commend about backward quote, seems fine to me. See the character at the end of the line: image.png1051251 27.6 KB If that was actually in your code, it would cause a problem. The most recent code you posted doesnt have that extra character so maybe it is not an issue. Your code looks like it would work, however be aware, I dont think you need the case for: SET OPSYSCMD = ON because if it is already ON then you can just leave it ON. If it is already OFF, then you cant turn it back on. So you can simply code it as: -DEFAULT &OPSYALLOW = 'N'; -IF &OPSYALLOW EQ 'Y' THEN GOTO EndSET; SET OPSYSCMD = OFF -EndSET SET OPSYSCMD Link to comment Share on other sites More sharing options...
Pawan Vuppala Posted June 24, 2021 Share Posted June 24, 2021 Thank you, that extra quote must be from this form/interface. The biggest problem is you can t SET this OPSYSCMD in a focexec, it needs to happen at profile level. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now