Access application items from other applications only through fetch_app_item? - oracle-apex

I have several applications in an Oracle APEX 19.2 workspace that use shared authentication. In order to access enduser metadata, I want to use an application item defined as global in the master application. It seems to be configered correctly: In a slave application, I can see the correct session value in the debugger windows (Session State, View: Application Items).
But the usual replacement syntaxes do not work: I can not access the value with any of those methods:
:VARIABLE
&VARIABLE.
apex_util.get_session_state('variable')
The only method that is working is apex_util.fetch_app_item('variable',[application id]) - this is cumbersome, as I would like to work with application aliases and I would need to translate the alias using the view apex_applications.
Is this working as intended or did I do something wrong?

Have you created the same application item in the slave application as well? You will also have to set it to Scope = Global. This will expose the value in the current application.

Related

How to Exclude Application Definition from Import in Oracle Apex

I need to have different values in substitution strings in DEV and PROD. How do I prevent overwriting the substitution strings when updating PROD. DEV and PROD are in separate databases.
I don't see how to exclude the application definitions in build options.
Is there a better way to meet this requirement?
Thanks
The way I see it, substitution strings are application items defined as constants. Only use them for strings that are always the same in any deployment instance of the app. As soon as the value needs to be changeable (for example dev has different value than prod), use application items instead.
If you insist on doing this with build options then this is an option:
Set the values of the application items using a computation or an application process (this is for for production).
Create a 2nd set of computations or an app process with a sequence higher than the sequence of the one above (so this will override the original values) and set a build option on those (exclude on export).
That way, when you export the app, only the first set of computations / app process will be included.
However, my preference is to configure this in the database and have a settings table that has a record indicating the status of the environment (prod/dev/stage/uat) and store the strings in a custom messages table (one record per app status/application item) . In an application process or computation get the value of the application items. The reason I prefer this is that the app doesn't need to know if it is dev or prod, but the database should. This option has a couple of challenges if the same database and schema is used for prod and dev.

Override method not being called from warehouse mobile application ax

I have been working on some requirement for advance warehouse mobile application in AX. The requirement was to do something when item is scanned. So in order to perform this I have registeroverridemethod of leave when item text box is build. The build methods is below:
//This method is updated in WhsWorkExecuteForm
protected void createTextBox(
container _textBox,
boolean _password = false)
{
FormBuildStringControl stringControl;
stringControl = controlGroup.addControl(FormControlType::String,this.elementName(_textBox));
if (this.elementHasError(_textBox))
{
stringControl.colorScheme(FormColorScheme::RGB);
stringControl.backgroundColor(WHSWorkExecuteForm::errorBackgroundColor());
}
stringControl.text(this.elementData(_textBox));
stringControl.label(this.elementLabel(_textBox));
stringControl.passwordStyle(_password);
stringControl.enabled(this.elementEnabled(_textBox));
//Below code is added to register override method
if(this.elementName(_textBox) == #ItemId)
{
stringControl.registerOverrideMethod(methodStr(FormStringControl,Leave),methodStr(WHSWorkExecuteForm,DynamicButtonControl_modified),this);
}
}
This method is being called when I run the warehouse app from AX AOT i.e. Action Menu item -> WHSWorkExecute but it is not working from browser. I have run the incremental CIL as well but no change.
Any idea? do I need to do changes in DisplayIEOS.aspx as well?
The web browser part of the Warehouse Mobile Device Portal is driven by xml files that are exchanged between the AOS and IIS website. You can read more about that in Warehouse Mobile Device Portal Architecture
The WHSWorkExecute form in the AOT of the Dynamics AX desktop client is basically a quick&dirty "emulator" of the web client. It enables you to test changes in the WHSWorkExecute framework logic that drives the mobile device functionality without having to set up the components that enable the web client. But changing this form at run time with FormBuild classes like in your code will have no effect on the web client, because this has no effect on the xml data sent to the website.
Instead, you should use the methods provided by the WHSWorkExecute framework to add controls. See Creating Custom Solutions with the Warehouse Mobile Device Portal, it has a section on the buildControl method of the framework.
How to handle a modified event of a control depends on what you want to do. The second link describes briefly how you could implement some client side only logic.
If you need to execute logic on the AOS, you would have to modify one of the specialized build methods or create your own. The second link also has some guidance on this. Registering override methods for FormControl objects will not work, because again this will not change the xml data sent to the web client.

How to programmatically dump Launch Services database?

How can I programmatically dump/query Launch Services database in MacOS (i.e. analog of command lsregister -dump)?
EDIT: I want to get set of associations UTI -> Bundle_IDs. Using LSCopyAllRoleHandlersForContentType - does not always work, here a similar trouble, therefore concluded that the best working method - parsing the output of "lsregister -dump", but the location of lsregister changes from version to version.

How to change client schema during provisioning?

I'm rushing (never a good thing) to get Sync Framework up and running for a "offline support" deadline on my project. We have a SQL Express 2008 instance on our server and then will deploy SQLCE to the clients. Clients will only sync with server, no peer-to-peer.
So far I have the following working:
Server schema setup
Scope created and tested
Server provisioned
Client provisioned w/ table creation
I've been very impressed with the relative simplicity of all of this. Then I realized the following:
Schema created through client provisioning to SQLCE does not setup default values for uniqueidentifier types.
FK constraints are not created on client
Here is the code that is being used to create the client schema (pulled from an example I found somewhere online)
static void Provision()
{
SqlConnection serverConn = new SqlConnection(
"Data Source=xxxxx, xxxx; Database=xxxxxx; " +
"Integrated Security=False; Password=xxxxxx; User ID=xxxxx;");
// create a connection to the SyncCompactDB database
SqlCeConnection clientConn = new SqlCeConnection(
#"Data Source='C:\SyncSQLServerAndSQLCompact\xxxxx.sdf'");
// get the description of the scope from the SyncDB server database
DbSyncScopeDescription scopeDesc = SqlSyncDescriptionBuilder.GetDescriptionForScope(
ScopeNames.Main, serverConn);
// create CE provisioning object based on the scope
SqlCeSyncScopeProvisioning clientProvision = new SqlCeSyncScopeProvisioning(clientConn, scopeDesc);
clientProvision.SetCreateTableDefault(DbSyncCreationOption.CreateOrUseExisting);
// starts the provisioning process
clientProvision.Apply();
}
When Sync Framework creates the schema on the client I need to make the additional changes listed earlier (default values, constraints, etc.).
This is where I'm getting confused (and frustrated):
I came across a code example that shows a SqlCeClientSyncProvider that has a CreatingSchema event. This code example actually shows setting the RowGuid property on a column which is EXACTLY what I need to do. However, what is a SqlCeClientSyncProvider?! This whole time (4 days now) I've been working with SqlCeSyncProvider in my sync code. So there is a SqlCeSyncProvider and a SqlCeClientSyncProvider?
The documentation on MSDN is not very good in explaining what either of these.
I've further confused whether I should make schema changes at provision time or at sync time?
How would you all suggest that I make schema changes to the client CE schema during provisioning?
SqlCeSyncProvider and SqlCeClientSyncProvider are different.
The latter is what is commonly referred to as the offline provider and this is the provider used by the Local Database Cache project item in Visual Studio. This provider works with the DbServerSyncProvider and SyncAgent and is used in hub-spoke topologies.
The one you're using is referred to as a collaboration provider or peer-to-peer provider (which also works in a hub-spoke scenario). SqlCeSyncProvider works with SqlSyncProvider and SyncOrchestrator and has no corresponding Visual Studio tooling support.
both providers requires provisioning the participating databases.
The two types of providers provisions the sync objects required to track and apply changes differently. The SchemaCreated event applies to the offline provider only. This get's fired the first time a sync is initiated and when the framework detects that the client database has not been provisioned (create user tables and the corresponding sync framework objects).
the scope provisioning used by the other provider dont apply constraints other than the PK. so you will have to do a post-provisioning step to apply the defaults and constraints yourself outside of the framework.
While researching solutions without using SyncAgent I found that the following would also work (in addition to my commented solution above):
Provision the client and let the framework create the client [user] schema. Now you have your tables.
Deprovision - this removes the restrictions on editing the tables/columns
Make your changes (in my case setting up Is RowGuid on PK columns and adding FK constraints) - this actually required me to drop and add a column as you can't change the "Is RowGuid" property an existing columns
Provision again using DbSyncCreationOption.CreateOrUseExisting

Kohana 3.1 Web Services Bootstrapping Based on Environment and Stored Like A Session

We are building a n-tiered style application in Kohana 3.1 which distributes JSONP powered widgets to our partners based on a partner_id.
Each partner needs to be able to call a widget and specify an environment parameter: test OR production with the initial call, which will be used to select the appropriate database.
We need our bootstrap to watch for $_REQUEST['environment'] variable and then to maintain the state of that variable whenever the partner makes a call to the widget service.
The problem is, that all requests in the application use Bootstrap.php, but many of the requests are internal - i.e. they do not come with a partner_id or environment variable. We tried to use sessions to store these, but as these are server-to-server GET/POST calls, it does not seem possible to store and recall the session id in a cookie on the server (this is browser-less GET).
Does anyone have any suggestions? We realise we could pass the environment variable with every single call internal or external, but this does not seem very robust.
We have a config file which stores partner settings (indexed by partner_id), such as the width and height of the widget and we thought about storing the partner's environment in here, but not all calls to the server would be made by a partner, so we would still need another way to trigger the environment for other calls and select the correct DB.
We also thought of storing a flat file for the partner which maintains the last requested environment, but again, as we have many internal requests after the initial one, we don't always have a knowledge (i.e. we don't usually care) which partner_id is used in the initial call.
Hope this makes sense...!
The solution would be to call the models and methods that are needed to 'do stuff' from a single controller, keeping the partner_id only in the controller and sending the requested data back once all of the 'do stuff' methods have been run, as per the MVC model.
i.e., request from partner -> route -> controller -> calls models etc -> passes back to controller -> returns view to partner
That allows the partner_id to be kept by the controller and only passed to whatever models require it to 'do stuff', keeping within the MVC framework.
If you've not kept within the confines of MVC, then things will obviously get more complex and you'll need to store the variable somewhere.