Forum Discussion

AndrewAndrew2's avatar
AndrewAndrew2
Qrew Trainee
10 years ago

This XML file does not appear to have any style information associated with it. The document tree is shown below.

Below is my URL formula ...


URLRoot()& "db/" &Dbid()& "?a=API_CopyMasterDetail" &

"&relfids=38" &

"&sourceRID=159" &

"&destrid="& [Record ID#];


Records copy, but when I click the button for copying the detail records I receive the XML File with the following data:


<qdbapi> <action>API_CopyMasterDetail</action> <errcode>0</errcode> <errtext>No error</errtext> <parentrid>3</parentrid> <numCreated>3</numCreated> </qdbapi>
Any help is appreciated!

8 Replies

  • Anytime you do a URL formula which edits or adds a record, you need to the redirect to display a record or a report as the next action, or else the API not so subtly reports its success or failure back to you.

    If you want to next reDisplay the Original Record, and for some reason you want to use the aPI method, it would be like

    var text URLONE = the code you had above ending in semicolon;

    var text URLTWO =

    URLRoot()& "db/" &Dbid()& "?a=API_EditRecord" &

    "&rid=" & [Record ID#]&

    "&_fid_42=1";



    var text URLTHREE = urlroot() & "db/" & dbid() & "?a=dr&rid=" & totext([Record ID#]);

    $URLONE
    & "&rdr=" & urlencode($URLTWO)
    & URLENCODE ("&rdr=" & urlencode( $URLTHREE))
  • I edited my answer above to take into account your full question including your other post.
  • Perfect .... thanks for your help Mark - much appreciated as usual.  Any idea where I can get some more specific directions regarding how to compile URL formulas? The API Documentation is good, but it doesn't do a very good job of explaining the nuances for the newbies like me.
  • There is an app I put in the Exchange called URL Formuals for Dummies.  The cover page has a bit of tutorial on how to nest the URLs for successive actions.  Have a read of that, and then you can post back with any questions or just contact me via my Profile info.
  • Mark - now I want to add a statement to check if the checkbox is false, and if it is, execute the URL fomula above, otherwise, respond with a message that the detail records have already been copied, and return to the form and do nothing. Possible?
  • We are starting to get out of my comfort zone but this might work

    var text URLnull="xx";

    if([checkbox field]=true,

    "javascript:" &
    "$.get('" &
    $url &
    "',function(){" &
    "$.jGrowl('Warning! You have already Imported Standard detail records.', {life: 5000});" &
    "});" &
    "void(0);",

    $URLONE
    & "&rdr=" & urlencode($URLTWO)
    & URLENCODE ("&rdr=" & urlencode( $URLTHREE)) )

    But another way to go is simply this

    if([checkbox field]=false,
    $URLONE
    & "&rdr=" & urlencode($URLTWO)
    & URLENCODE ("&rdr=" & urlencode( $URLTHREE)) )

    if you do that and the checkbox is true (ie already imported) , then the formula is null and the button will be blank with nothing to click on.