EXPORT CONTENT from DocBase using API

Options
Sri_Kumaran
edited November 20, 2013 in Documentum #1

Hi, I have went through Documentum API Reference Guide. I'm able to execute single line commands in DA and DqMan as well. 

I need to export bulk contents from DocBase using API Scripts. I tried below script. Its throwing some error message. Can you please help me?  

query_str = "select r_object_id, ots_doc_number, object_name, a_content_type from literature_document where title is not NULLSTRING and r_is_virtual_doc = 0 and i_latest_flag = 1"

query_id = dmAPIGet("query,"session",query_str")

while( dmAPIExec("next,"session", query_id") > 0 )
{

doc_id = dmAPIGet("get,"session","query_id",r_object_id")

doc_num = dmAPIGet("get,"session","query_id",ots_doc_number")

obj_name = dmAPIGet("get,"session","query_id",object_name")

cnt_typ = dmAPIGet("get,"session","query_id",a_content_type")

name = S:\Export_Lit\ "obj_name" _ "doc_num" ."pdf" 

getfile,c,doc_id,name,cnt_typ

}

Thank you so much !!

Tagged:

Comments

  • Sri_Kumaran
    edited April 29, 2013 #2
    Options

    Brian Dinneen Can you please help me on this?

  • christopher.imes
    edited November 15, 2013 #3
    Options

    Please consider moving this question as-is (no need to recreate) to the proper forum for maximum visibility.  Questions written to the users' own "Discussions" space don't get the same amount of attention and can go unanswered for a long time.

    You can do so by selecting "Move" under ACTIONS along the upper-right.  Then search for: "Documentum" and select the first result that appears.  This will relocate it to the Developer Network space of the Documentum community.

    Documentum

    For further guidance on engaging with the communities for Documentum and related products, please refer to the

    IIG Communities Getting Started Guide.

    Seeing though that over 6 months have elapsed since you posted, maybe you have already found the answer (possibly opened up a ticket with support)?  If so, once relocated, consider sharing the resolution and also marking the question as "Answered" so that it can help others that have the same question.  If not, once relocated, it will then have more visibility by the community of dedicated customers, partners, and EMC employees that are eager to assist.

  • Sri_Kumaran
    edited November 15, 2013 #4
    Options

    Hi Chris,

    I have moved to Documentum.

    Thanks you so much!

    Sri

  • msroth
    edited November 19, 2013 #5
    Options

    Any reason you are using the API and not the DFC?

    Anyway, the last API call in the loop should look more like this:  dmAPIGet("getfile","session","doc_id","name","cnt_type")

    I have to caveat this advice by saying:  I don't have an API guide with me, so I don't know if dmAPIGet() is the correct API to use with the "getfile" command (it might be dmAPIExec()).  Also, I am trusting your formatting of the arguments for the "getfile" command are correct since I can't verify them.

    I built a pretty versatile and easy to use exporter here if you want to use it or take it apart to learn from it: http://msroth.wordpress.com/2013/05/28/documentum-bulk-export-tool/

  • PanfilovAB
    edited November 19, 2013 #6
    Options

    You are overstating the task, all that @Sri_Kumaran is need - write SQL to generate API, oracle example:

    SELECT    'getfile,c,'
           || doc.r_object_id
           || ',S:\Export_Lit\'
           || REPLACE (object_name, ',', '')
           || CASE
                 WHEN ROW_NUMBER ()
                      OVER (PARTITION BY REPLACE (object_name, ',', '')
                            ORDER BY NULL) > 1
                 THEN
                       '_'
                    || ROW_NUMBER ()
                       OVER (PARTITION BY REPLACE (object_name, ',', '')
                             ORDER BY NULL)
              END
           || CASE
                 WHEN fmt.dos_extension IS NOT NULL AND fmt.dos_extension <> ' '
                 THEN
                    '.' || fmt.dos_extension
              END
              ots_doc_number,
           object_name,
           a_content_type
      FROM literature_document_sp doc, dm_format_sp fmt
    WHERE     doc.title IS NOT NULL
           AND doc.title <> ' '
           AND doc.r_is_virtual_doc = 0
           AND doc.i_latest_flag = 1
           AND doc.a_content_type = fmt.name(+);

  • michaeljmeza
    edited November 20, 2013 #7
    Options

    Using the DFC option would be more reasonable, Though the PSQL/SQL is also viable and better then API.

    I recommend using the DFC if there are a lot of objects in the database as SQL or PSQL could slow down the system or even bring it to a grinding halt.  If this is non production the by all means use whatever method you want

  • PanfilovAB
    edited November 20, 2013 #8
    Options

    And how is SQL able to slowdown the system? I do think you do not understand the main idea of script.

  • michaeljmeza
    edited November 20, 2013 #9
    Options

    Not in regards to your SQL, which is just making all the API scripts. I mean SQL as a solution to pulling the data and objects out.

    I still stand by DFC being the faster cleaner method to get the results he wants

  • PanfilovAB
    edited November 20, 2013 #10
    Options

    What is the best option completely depends on performer. You have some IDE, but there is no IDE for dmbasic, so you think that dmbasic is not suitable for you. I think that the best option to automate some administrative routines is VB with PIA, but EMC does not develop PIA anymore If you're taking that SQL is not good option to update docbase data, I completely agree, but when I should perform a lot of simple updates I would prefer to generate corresponding API using SQL rather then coding something in Java.

  • michaeljmeza
    edited November 20, 2013 #11
    Options

    If you are updating objects I agree SQL/DQL. But he is wanting to export, DFC is the fastest option, preferably in a threaded application.