Global Code for IR region refreshes, is this possible? - oracle-apex

Apex 18
I've succesfully followed these steps to capture IR SQL details on a report using the standard API.
Essentially with some PL/SQL code in an "after refresh" DA of a IR region, we can capture the SQL used to render the report.
I save the SQL and binds for use later - to create flat files. (Don't ask, it's just the requirement..) :)
https://content.dsp.co.uk/apex/a-reference-apex-application-for-apex_ir-get_report
That all works fine, my questions i not about how/why to save IR SQL. My problem is that we have hundreds of pages in this application and it's not feasible to add this DA to every page and IR region.
How can I create a means to globally (page 0) execute PL/SQL after refresh of "a" region?
Can I create a static region on my global page with a DA?
or ".t-Region" ? (My JS is really bad..)
I'm using the below train of thought where the author is executing a DA for dozens of regions, but his is all on the same page...
https://rimblas.com/blog/2020/06/a-single-dynamic-action-to-refresh-multiple-reports/
Barry

Related

Is it possible to save reports and data transformation steps in PowerBI?

I have prepared some reports based on the files I prepared. I am wondering is it possible to save this report (measures and visualizations) and also the steps I made while transforming data? I want to be able to load new files (which in the structure are the same as the ones I used creating my report) and the data transformation and report done automatically on this updated data.
Is it possible?
You can save it as a template - file extension pbit. It saves only the structure of the file, without actual data. When opening the report it refreshes it, and if there are parameters in the report (e.g. folder/file path or server address) it will refresh it considering the input values
you can read more here
https://learn.microsoft.com/en-us/power-bi/create-reports/desktop-templates
You can simply save your file as a template.

Exporting with SAP using Python

I am trying to automate some steps in SAP with Python. I am able to do it for other type of SAP codes except for one where the Excel Export is only chosen through the menu bar "list", then "export", then "spreadsheet". Then a dialog box pops up with the request of the location and name of the file.
The issue I ran into with this case is that the Python code does not bring up steps above like it does with other SAP portion. I use the record Macro of SAP to save it in VBscript and put that into the python code.
session.findById("wnd[0]").maximize
session.findById("wnd[0]/mbar/menu[0]/menu[4]/menu[1]").select
session.findById("wnd[1]/usr/ctxtDY_PATH").text = "directory"
session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "filename"
session.findById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 8
session.findById("wnd[1]/tbar[0]/btn[0]").press
The second line of this code results in nothing. Even though it should activate the menu bar, etc.
Your help in resolving this is appreciated.

SAS - Create new libraries nested inside WORK

tl;dr: Can SAS libraries be nested within one another in the Enhanced Editor Explorer?
I am working with code which generates a plethora of data sets. Although there are many individual data sets, they can be grouped into various categories. For instance, perhaps 30 of them are incoming "raw" data, another 50 are analysis "results" and the remaining 20 are "intermediate" steps.
Currently, all 100 data sets reside in the Work directory. They have been well named so that they appear next to one another in the SAS Explorer window. However, I would prefer to organize them in folders.
One way to do this is to create new directories within the temporary Work folder.
%let dirWORK = %sysfunc(pathname(Work));
options dlcreatedir;
libname raw "&dirWORK./raw";
libname interm "&dirWORK./intermediate";
libname results "&dirWORK./results";
As sub-directories of Work, these directories and their contents will be deleted when the session ends. This is agreeable.
Not agreeable is how the raw, iterm, and results libraries appear one level up in 'Active Libraries' instead of within the 'Contents of "Work"'. This behavior is somewhat counter-intuitive and awkward.
Is there a way to view the sub-folders of Work within the 'Contents
of "Work"' in the SAS Explorer?
Perhaps there's another way to separate the data sets (DCREATE?) which causes the Explorer window to behave like a typical file browser?
Libraries can contain many things.. But not other libraries. Your 'Active Libraries' will always show your (available) list of libraries at the same level, regardless of where or how they were defined:
One option if you'd like to view your datasets like a typical file browser is to use the Explorer window. Just click View / Explorer, and navigate to your datasets that way..
eg:
%let dirWORK =C:/temp/work;
options dlcreatedir;
libname raw "&dirWORK./raw";
libname interm "&dirWORK./intermediate";
libname results "&dirWORK./results";
data raw.test;
set sashelp.class;
run;
SAS librefs are just single words, so by definition there is no heirarchy. You could try using librefs that will place them next to each other alphabetically? Perhaps WORKIN, WORKMID, WORKOUT. Then they would sort in logical order.
You could use a file explorer to browse the directory structure you have created, but I don't think the SAS Explorer tool in SAS Display Manager can handle that.
DMS does have a file explorer tool you could try. You can start directly on your current WORK directory by running this command from the command line of any window, or via the DM statement in a program.
exproot dir="%sysfunc(pathname(work))" title="Work Directory"
There appears to be no ideal solution. The best I could devise requires the use of two part names, a non-trivial amount of extra code, a custom setup, and is potentially confusing to other programmers. The easiest configuration appears to be the default behavior: simply dumping all data sets in the Work library and sifting through all of them.
For prosperity, here is the best solution I could devise to organize things.
Understanding the Display Manager and Explorer Window
The Display Manager (DM) controls the various windows in the Enhanced Editor. This includes windows such as log, results, pgm, output and explorer. It is the latter which is of principle interest here.
A user may configure windows per session using the menus. There exist, however, a set of commands which may be used to automatically configure the DM for each session. When used with the AUTOEXEC.sas facility, this allows the user to 'permanently' configure the SAS editor to their preferences.
The default explorer view for the Enhanced Editor is the "Contents of 'SAS Environment'".
When the explorer window is selected, a tree hierarchy view can be toggled. There are several ways to do this. Here is one way:
Select the explorer window
View > Show Tree
Having to do this every time SAS is opened becomes a pain. After we clean up the library tree, we will automate this.
Remove any extraneous libraries
SAS loads a variety of libraries by default. These include WORK, SASHELP, and SASUSER, as well as others that are part of non-base products. In my case, the MAPS, MAPSGFK, and MAPSSAS libraries are also loaded (see above picture). As I never have used these (and likely never will), they only serve to clutter up my library directory. To remove these, one can edit their config file.
SAS implements a whole web of config files. On a Windows system, the likely relevant sasv9.cfg file is located here:
C:\Program Files\SASHome\SASFoundation\9.4\nls\en
You will need admin rights to edit it. Disregarding the DO NOT EDIT BELOW THIS LINE warning, comment out the the following using PL/I style comments.
Un-commented:
-MAPS !SASROOT\maps
-MAPSGFK !SASROOT\mapsgfk
-MAPSSAS !SASROOT\maps
Commented:
/* -MAPS !SASROOT\maps*/
/* -MAPSGFK !SASROOT\mapsgfk*/
/* -MAPSSAS !SASROOT\maps*/
Now when SAS opens, the MAPS, MAPSGFK, and MAPSSAS library will not be automatically loaded. Unfortunately, there does not seem to be a way to disable the loading of the SASUSER and SASHELP libraries. If someone knows how, please let me know!
Configure the Explorer Window
The explorer window can be 'configured' using the DM statement and the AUTOEXEC.sas facility.
Navigate to the directory containing SAS.EXE. On a default Windows installation, it is located here:
C:\Program Files\SASHome\SASFoundation\9.4
Create a SAS program named AUTOEXEC.sas containing the following code and place it in the directory which contains SAS.EXE. This step requires admin privileges. I find it easiest to create the file in a non-privileged environment and simply copy the AUTOEXEC.sas program into the directory.
Include this in the AUTOEXEC.sas program:
dm 'dmsexp; tree; expand libraries; expand work;';
When SAS intializes, the AUTOEXEC.sas code is executed before any user input is accepted. The above code does the following:
dmsexp - Brings the explorer window into command focus.
tree - Toggles the tree hierarchy view.
expand libraries - Within the "Active Libraries" pane, drills down into Libraries.
expand work - Within the "Active Libraries" pane, drills down into the Work library.
Each of these is a separate command and could be issued on separate lines. Instead of this, semi-colons are used to issue them in a single line.
Now when SAS is opened, the tree menu is available and the contents of the Work library are viewed. The picture below is somewhat deceiving. The "SAS Environment" pane is not set to a convenient width as pictured. It must be manually adjusted. If anyone has a way to automate this, please let me know!
Storing data sets in sub-folders
To ensure that data sets are deleted when the SAS session ends, sub-folders needs to be created within the temporary system folder where the Work library points to.
The following structure can now be followed:
/*Determine location of Work directory*/
%let dirWORK = %sysfunc(pathname(Work));
/*Allow LIBNAME statement to create new directories*/
options dlcreatedir;
/*Create sub-folders within the temporary Work directory
and assign librefs*/
libname raw "&dirWORK./raw";
libname interm "&dirWORK./intermediate";
libname results "&dirWORK./results";
Now, all the raw data sets can be assigned to the raw library. Within SAS, they will be logically separated from Work. That is, if the data set foobar is created in the raw library, it can only be accessed via raw.foobar. A statement such as data = foobar or data = work.foobar will not work. Yet because the raw library is in fact a sub-folder of Work, it will be deleted when the SAS session is ended.

Update sql not being executed for my component Joomla 2.5

I am trying to add a few new columns to certain tables in Joomla, since i need to migrate these fixes from dev to production i am trying to do this the clean way, updates trough the filesystem.
I have followed a few tutorials concerning this and did the following.
I created the folder updates/sql and put a new sql file in it with my new version (1.5).
I changed the version number in my xml file.
I refreshed my cache in the backend.
Here are the codes I used:
My version:
<version>1.5</version>
The update node:
<update>
<schemas>
<schemapath type="mysql">sql/updates/mysql</schemapath>
<schemapath type="sqlsrv">sql/updates/sqlsrv</schemapath>
<schemapath type="sqlazure">sql/updates/sqlazure</schemapath>
</schemas>
</update>
The sql file:
ALTER TABLE `#__mycomponent` ADD `field` VARCHAR(255);
I tested my query directly against the database and it worked, what am I missing?
Short answer - Joomla!'s DB migration tool only does them after uploading a new component via the Component Manager. It doesn't check for a migration on every $_REQUEST, which is what your question suggests.
Longer Answer
Make sure you run the upgrade via the component manager. Simply over-writing the files doesn't trigger Joomla's migration process. Check the #__schemas table for your component's ID, and it'll have a corresponding database schema version #. If that version hasn't incremented yet, then the migration wasn't applied.
Part of the problem is
I am trying to do this the clean way, updates trough the filesystem
While I agree with you, that would be the clean way: Joomla! wants you to do things the Joomla! way ;-)
Important Note about Joomla! SQL Files
SQL files cannot contain C style comments (# comment here), and must contain comments like this -- comment here Spent a few hours debugging my own code, and had to re-run an upgrade about 25 times to figure out where the database schema migration was failing.
Comments may support the /* Comment */ style syntax, but I have yet to test that as extensively. YMMV.

How can Excel 2007 / 2010 consume a REST web service?

What options exist to consume a REST web service from within Excel 2007 / 2010? I can use XML Maps to consume a basic XML list, but that doesn't let me build a dynamic URL (so I could include parameters).
For example, I can add an XML Map to Excel for http://machine/service/level/5 and display the values in the workbook just fine - no problem there. The real question is, how can I dynamically change the /5 part of the URL to come from another cell in excel?
That way I can have a couple of cells that have the options (what ID, what name, etc.) and whenever those values change (ideally) a new dynamic URL would be constructed and the XML map would be refreshed.
Is such a thing possible? Does anyone else have a better way to take some parameters, call a web service (REST or SOAP, I'm not picky) and shove the results back into excel for further manipulation?
XLLoop (http://xlloop.sourceforge.net/) can be used to call make Json of HTTP calls.
You can use PowerPivot with Excel 2010. Download from here.
From the home tab select 'From Data Feeds', then 'From Other Feeds'.
You should be able to use this to point to your URL.
I've read that PowerPivot uses REST but I haven't tried it myself.
Good luck! :)