Populate workspace from code?

Posted by Simon de Kraa on 05-Jul-2016 01:57

I am looking for an API to populate a workspace from code. The rtb_api.p is not much help. I also created some API's myself a long time ago. But to be honest I am not sure where to start anymore. Thanks. [/mls01/rtb/rtb101c/gui/rtb/p] grep ^PROC rtb_api.p PROCEDURE add_task : PROCEDURE assign_object : PROCEDURE check_in_object : PROCEDURE check_object_integrity : PROCEDURE check_out_object : PROCEDURE compile_object : PROCEDURE complete_task : PROCEDURE create_object : PROCEDURE create_variant : PROCEDURE create_xrefs : PROCEDURE delete_object : PROCEDURE extract_object : PROCEDURE login : PROCEDURE logout : PROCEDURE selective_compile : PROCEDURE set_paths : PROCEDURE set_session_id : PROCEDURE set_task : PROCEDURE set_workspace_id : PROCEDURE unlock_object : [/mls01/rtb/rtb101c/gui/rtb/p] grep ^PROC rtb_api.i PROCEDURE get_object_share_status: PROCEDURE set_object_share_status: PROCEDURE get_object_version_note: PROCEDURE set_object_version_note: PROCEDURE check_available_task: PROCEDURE get_task_directory: PROCEDURE get_object_absolute_pathnames: PROCEDURE get_object_version: PROCEDURE get_object_version_task: PROCEDURE get_object_update_status: PROCEDURE get_object_object_status: PROCEDURE check_available_object: PROCEDURE get_workspace_tasks: PROCEDURE get_task_objects: PROCEDURE get_object_versions: PROCEDURE get_object_product_module: PROCEDURE set_wspace_id : PROCEDURE check_available_object_alias: PROCEDURE get_object_version_description: PROCEDURE set_object_version_description: PROCEDURE get_object_details: PROCEDURE get_object_version_details: [/mls01/rtb/rtb101c/gui/rtb/p]

All Replies

Posted by Simon de Kraa on 05-Jul-2016 01:58

Why are my posts always on one line after posting?

Posted by cverbiest on 05-Jul-2016 03:20

Which RTB version are you using ? the path seems to indicate rtb 10.1c.

In a recent RTB version I'd check if the automation toolkit can do it.

AFAIK you need to

for each rtb_object where wspace-id = myworkspace:

run rtb_nams to get the paths.

create the directories , not sure if it's required but it's in my code.

run rtb_extract_object to extract.

end.

Don't know how to attach code here so I'll mail something .

Posted by Simon de Kraa on 05-Jul-2016 03:29

Yes, we are still using 10.1C... Thanks, but I was hoping to directly call the procedure that is behind the menu Workspace, Workspace Maintenance, <select workspace>, File, Populate Workspace.

Posted by Simon de Kraa on 05-Jul-2016 04:04

It is probably ./rtb/w/rtb_popws.w but it is encrypted so I have to figure out the i/o parameters. Any ideas? Probably I need the wspace-id...

Posted by cverbiest on 05-Jul-2016 04:17

If you don't mind being on an uncharted, undocumented path , r-code is partially human readable. You can see the signatures of routines.

Posted by Simon de Kraa on 05-Jul-2016 04:25

Thanks, probably need to run it persistent and run the populate_workspace procedure...

Edit: no that is not true. probably can run it directly...

[/mls01/rtb/rtb101c/gui] strings ./rtb/w/rtb_popws.r  | head -10

29E000D9utf-8

MAIN rtb\w\rtb_popws.w,,INPUT Pwspace-id CHARACTER

PROCEDURE RTB_xref_generator,,

PROCEDURE populate_workspace,,

PROCEDURE initializeObject,,

PROCEDURE enable_UI,,

PROCEDURE disable_UI,,

PROCEDURE adm-create-objects,,

PROCEDURE start-super-proc,,INPUT pcProcName CHARACTER

PROCEDURE adm-clone-props,,

[/mls01/rtb/rtb101c/gui]

Posted by Simon de Kraa on 05-Jul-2016 04:34

It is the correct functionality but unfortunately this has a GUI in front of it. :-(

Posted by Jeff Ledbetter on 05-Jul-2016 07:30

  DEFINE VARIABLE Merror   AS CHARACTER NO-UNDO.
  DEFINE VARIABLE MhStatus AS HANDLE    NO-UNDO.
  DEFINE VARIABLE Mok      AS LOGICAL   NO-UNDO.

  MESSAGE SUBSTITUTE("Populate module(s) '&1' in workspace '&2'?",Mmodule,Pwspace-id)
    VIEW-AS ALERT-BOX WARNING
    BUTTONS YES-NO
    TITLE Malert-title
    UPDATE Mok.

  IF Mok THEN DO:
    SESSION:SET-WAIT-STATE("GENERAL":U).
    
    /*
     Display status window
    */
    IF CONNECTED("rtb":U) THEN DO:
      RUN hideObject IN SOURCE-PROCEDURE.
      MhStatus = DYNAMIC-FUNCTION('fnRtbRunWindowOnce':U,"rtb/w/rtb_procstat.w").
      RUN rtb_set_window_title IN MhStatus (INPUT Malert-title).
    END.

    SESSION:SET-WAIT-STATE("GENERAL":U).
    Merror = DYNAMIC-FUNCTION('fnRtbPopulateWorkspace':U IN h_rtb_u_ws,Pwspace-id,Mmodule).
    SESSION:SET-WAIT-STATE("").

    IF VALID-HANDLE(MhStatus) THEN DO:
      RUN destroyObject IN MhStatus.
      MhStatus = ?.
      RUN viewObject IN SOURCE-PROCEDURE.
    END.

    IF Merror <> "" THEN
      MESSAGE Merror
        VIEW-AS ALERT-BOX ERROR
        TITLE Malert-title.
    ELSE
      MESSAGE SUBSTITUTE("Module '&1' in workspace '&2' successfully populated.",Mmodule,Pwspace-id)
        VIEW-AS ALERT-BOX INFO
        TITLE Malert-title.
  END. /* Mok */

  RETURN.

Posted by Jeff Ledbetter on 05-Jul-2016 07:44

As long as Roundtable is running, you should just be able to execute this code as the Workspace procedure library is running super to the session.

Posted by Simon de Kraa on 05-Jul-2016 08:48

Thanks!

Posted by Simon de Kraa on 14-Jul-2016 08:08

Follow-up question. Is it also possible to populate to a different directory other than the workspace directory?

Posted by Jeff Ledbetter on 14-Jul-2016 08:15

Hi Simon.  No, not from the Populate Workspace routine.

You could create a Deployment which lets your specify the output directory. The Automation Toolkit has an API to help with Deployments.

Posted by Jeff Ledbetter on 14-Jul-2016 08:15

Hi Simon.  No, not from the Populate Workspace routine.

You could create a Deployment which lets your specify the output directory. The Automation Toolkit has an API to help with Deployments.

This thread is closed