Hello, so far I was using a below scripts for exporting application from one db and importing into other one. But since 1.9 it stopped to work. Was there any change?

Please see my scripts:

ExportImport.bat

echo ....................
echo ....................
echo EXPORT APPLICATION FROM FORMSPIDER SCHEMA
echo ....................
echo ....................
sqlplus formspider/some_dev_pwd@DEV @exportApplication.sql

echo ....................
echo ....................
echo IMPORT APPLICATION TO FORMSPIDER SCHEMA
echo ....................
echo ....................
sqlplus formspider/some_live_pwd@LIVE @importApplication.sql

echo All Done.
pause

exportApplication.sql

declare
  cursor c is
     select NAME_TX, DEV.API_FS_APP_VERSION.get_version_ag_doprava version
       from T_BDF_APPLICATION
       where NAME_TX = 'AG Doprava'; 
     -- where NAME_TX != 'FormspiderIDE';

  v_xml                 xmltype;
  v_applicationName_tx  varchar2(255);
  v_directoryName_tx    varchar2(255) := 'FORMSPIDER_DIR';
  ------------------------------------------------------------------------------
  procedure saveCLOBtoFile(in_directoryName_tx varchar2, in_filename_tx varchar2, in_application_xml xmltype)
  is
  begin
    dbms_xslprocessor.clob2file(xmltype.extract(in_application_xml, '/*').getClobVal(), in_directoryName_tx, in_filename_tx);
  end;
  ------------------------------------------------------------------------------
BEGIN
  for x in c loop
    v_applicationName_tx := x.NAME_TX;
    v_xml := api_application.export(v_applicationName_tx);
    saveCLOBtoFile(v_directoryName_tx, v_applicationName_tx||'-'||x.version||'.xml',v_xml);
  end loop;
END;
/

exit;

importApplication.sql

   declare
  v_oracleDirectory_tx varchar2(255) := 'FORMSPIDER_DIR'; 
  v_applicationName_tx varchar2(255) := 'AG Doprava';
  v_xmlFileName_tx varchar2(255) := v_applicationName_tx||'-'||DEV.API_FS_APP_VERSION.get_version_ag_doprava||'.xml';
  v_cl clob;

  v_file bfile;
  v_destoffset number:=1;
  v_srcoffset number:=1;
  v_warning number:=0;
  v_context number:=0;

  v_objectRecord_tt bdf_etl.tt_importObjects;

begin

  bdf_application_api.applicationdelete(in_application_oid=>bdf_application_qry.getid(v_applicationName_tx), in_cascade_yn=>'Y');

  dbms_lob.createtemporary(v_cl,true);
  v_file  := BFILENAME(v_oracleDirectory_tx, v_xmlFileName_tx);

  dbms_lob.open(v_file, dbms_lob.lob_readonly);

  dbms_lob.loadclobfromfile(v_cl, v_file, DBMS_LOB.LOBMAXSIZE , v_destoffset, v_srcoffset, nls_charset_id('AL32UTF8'), v_context, v_warning);

  dbms_lob.close(v_file);

  bdf_etl.load(in_bdf_xml=>xmltype(v_cl),
               in_importOption_cd =>'AsNewApplication',           -- leave it as it is
               in_projectOption_cd=>bdf_constant_etl.etlcreateOrReplace,
               in_applicationOption_cd=>bdf_constant_etl.etlcreateOrReplace,
               in_importObjects_tt=>v_objectRecord_tt);

  commit;
end;
/

exit;

Then I used to run only ExportImport.bat, but since in 1.9 a newly imported application is not imported correctly.

Thanks, Tomas

asked 24 Oct '15, 16:09

Tomeo's gravatar image

Tomeo
162351
accept rate: 3%


Hi Tomas,

Formspider 1.9 has new export/import API's.

You can use this code to import into an existing application:

declare
  v_template_cl clob;
begin
  v_template_cl:=--custom function which returns the correct export file's content
  bdf_etl_api.import(IN_APP_CL=>v_template_cl, 
                    IN_NEWAPPNAME_TX=>null, 
                    IN_NEWDSSCHEMA_TX=>null,
                    IN_APP_ID=>bdf_application_qry.getid('<TargetApplicationName>'), 
                    IN_CREATEMODE_CD=>bdf_constant_etl.etlcreatemissingonly); -- or use bdf_constant_etl.etlcreateorreplace
end;

You can use this code to import your export file as a new application:

bdf_etl_api.import(IN_APP_CL=>v_applicationExport_cl, 
                    IN_NEWAPPNAME_TX=>'MyNewApp', 
                    IN_NEWDSSCHEMA_TX=>'MyNewDataSourceSchema');

Hope this helps.

Kind Regards,
Yalim

link

answered 27 Oct '15, 04:41

Yalim%20Gerger's gravatar image

Yalim Gerger ♦♦
1.8k5
accept rate: 15%

Hi Yalim,

thanks for the script I'll give it a try.

Can you please provide also a script for application export? A file exported using api_application.export(v_applicationName_tx); is different from the file exported via IDE application.

Thanks, Tomas

(27 Oct '15, 05:36) Tomeo

When importing through IDE Application, then I get bellow error message:

All Formspider Objects are not loaded successfully: ORA-01422: přesné načtení vrací více než požadovaný počet řádek ORA-06512: na "FORMSPIDER.BDF_APPLICATION_QRY", line 12
ORA-06512: na "FORMSPIDER.BDF_IDE_IMPORTWIZARD_PKG", line 2090
link

answered 24 Oct '15, 16:30

Tomeo's gravatar image

Tomeo
162351
accept rate: 3%

Hi Tomas,

You can use the following API in the bdf_etl_api package for export.

function export(in_app_id number)return clob;

Kind Regards,
Yalim

link

answered 27 Oct '15, 07:45

Yalim%20Gerger's gravatar image

Yalim Gerger ♦♦
1.8k5
accept rate: 15%

Thank you Yalim!

(29 Oct '15, 05:10) Tomeo
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×13
×8
×4

Asked: 24 Oct '15, 16:09

Seen: 1,095 times

Last updated: 29 Oct '15, 05:10


© Copyright Gerger 2017