Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

APEX 4.0 : how to copy page from one application to another application in APEX

Tags:

oracle-apex

Please help me how to copy a page from the existing application of Apex to another work space of Apex application.

like image 936
sachin rv Avatar asked May 21 '13 09:05

sachin rv


1 Answers

You can't do this out of the box.
Beside workspace ids, the application id also matters. If you have 2 different workspaces and the same application in it but with different IDs, this further complicates things.
What you could always do is export the complete application, import it but use a different id so you don't overwrite the existing one, and then create a new page as a copy of the newly imported application's page.

Antoher way would be to edit the exported PAGE SQL file but, let me stress this, this is not recommended. And as so graciously stated in the OTN forums now and again, if you'd require support with an application/apex issue and they would find you were messing around in the sql files you'd not get support there. Only do this when you UNDERSTAND and KNOW what you're about to do! If you alter the code without understanding what you are doing you could be in a far worse situation than the one you started in. Any other case, follow the application export/import/copy line.

Anyway, I was in a position where workspace IDs differed but application IDs not. In this case altering the exported file is quite trivial and requires editing only 1 (one) line and concerns this piece of code:

begin

  -- Assumes you are running the script connected to SQL*Plus as the Oracle user APEX_040200 or as the owner (parsing schema) of the application.
  wwv_flow_api.set_security_group_id(p_security_group_id=>nvl(wwv_flow_application_install.get_workspace_id,27000294100083787867));

end;
/

This is one of the first pieces of code in the exported page file. As you can see, the workspace ID is set here. If attempted to be imported into an application (even if the app id matches the one you're trying to import to) you'd get an error. Change the ID to the one matching the workspace however and it'll work. Of course, you need to know the workspace IDs, and you can find these by executing this select on your apex environment(s?)

select workspace, workspace_display_name, workspace_id from apex_workspaces

Some good advice:
If you're still in the start-up phase of your apex installation, you might want to make sure that your workspace ids are identical. For example, with a test and production environment having identical workspace and application ids is very interesting. You'd have 2 instances (2 database installations on 2 different servers), but want the IDs to be the same.
To make sure of this, you can EXPORT the workspace from one environment and then IMPORT it into the other one. You can do that from the instance administration in apex, ie the internal workspace.

like image 77
Tom Avatar answered Nov 02 '22 14:11

Tom