Discussions

Expand all | Collapse all

Formula help

  • 1.  Formula help

    Top
    Contributor
    Posted 04-05-2018 12:05
    I am attempting to create a new record in another table and prefill the parent table.  It works on existing records.  For example I created a test record and when I click my button (formula shown below) then it creates the parent record as it is supposed to.  When I click new record on the child and go through the steps, click on the button, it says the record does not exist.  


    Formula:
    URLRoot() & "db/" & [_DBID_TABLE_1] & "?a=API_AddRecord&_fid_345=" & URLEncode ([Record ID#])& 

    "&_fid_365=" & URLEncode ([BU-Plant])& 
    "&_fid_347=" & URLEncode ([Related Point of Origin])& 
    "&_fid_350=" & URLEncode ([Related Point of Discovery])& 
    "&_fid_305=" & URLEncode ([Defect Category])& 
    "&_fid_110=" & URLEncode ([Related Defect Code])& 
    "&_fid_29=" & URLEncode ([Quantity Inspected])& 
    "&_fid_30=" & URLEncode ([Defect Quantity])& 
    "&_fid_31=" & URLEncode ([Unit of Measurement])& 
    "&_fid_32=" & URLEncode ([Disposition])& 
    "&_fid_291=" & URLEncode ([Disposition Comments])& 
    "&_fid_356=" & URLEncode ([Related Part Location Name])&
    "&_fid_24=" & URLEncode ([Defect Description])&

    "&z=" & Rurl()& "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])


  • 2.  RE: Formula help

    Posted 04-05-2018 12:25
    If you want to automatically create a child when a parent is created, you can use an Action..


  • 3.  RE: Formula help

    Posted 04-05-2018 12:25
    The record ID# of the record that you are sitting in will not exists until the record is saved. Hence that button will create an orphan child record as the child will not be connected to the parent


  • 4.  RE: Formula help

    Top
    Contributor
    Posted 04-05-2018 12:55
    Can I not create a code before the formula to save the current record? 


  • 5.  RE: Formula help

    Top
    Contributor
    Posted 04-05-2018 13:08
    I thought I could add this code in front but it is not working.  

    URLRoot() & "db/" & [_DBID_DEFECTS_NCRS_CARS] & "?a=API_GenAddRecordForm" & URLEncode ([Record ID#])& "&z=" & Rurl() & "&dfid=3"&


  • 6.  RE: Formula help

    Posted 04-05-2018 13:34
    See my previous responses.  The [Record ID#] does not exists until the record is saved.  If you goal is to automatically create a child when the parent is created, then I suggest using an ACTION.


  • 7.  RE: Formula help

    Top
    Contributor
    Posted 04-05-2018 13:37
    Yes I read this.  I do not need it to always create a parent record.  thanks anyways.  


  • 8.  RE: Formula help

    Posted 04-05-2018 13:43
    Then you will need to only show that button only in Edit or View mode so that the [Record ID#] field is populated.


  • 9.  RE: Formula help

    Top
    Contributor
    Posted 04-05-2018 13:50
    okay that is helpful.  Thanks.  


  • 10.  RE: Formula help

    Top
    Contributor
    Posted 04-05-2018 13:58
    One more thing.  Is there a way to add the record but stay in edit mode.  

    When I click this button:
    URLRoot() & "db/" & [_DBID_TABLE_1] & "?a=API_AddRecord&_fid_345=" & URLEncode ([Record ID#])& 

    "&_fid_365=" & URLEncode ([BU-Plant])& 
    "&_fid_347=" & URLEncode ([Related Point of Origin])& 
    "&_fid_350=" & URLEncode ([Related Point of Discovery])& 
    "&_fid_305=" & URLEncode ([Defect Category])& 
    "&_fid_110=" & URLEncode ([Related Defect Code])& 
    "&_fid_29=" & URLEncode ([Quantity Inspected])& 
    "&_fid_30=" & URLEncode ([Defect Quantity])& 
    "&_fid_31=" & URLEncode ([Unit of Measurement])& 
    "&_fid_32=" & URLEncode ([Disposition])& 
    "&_fid_291=" & URLEncode ([Disposition Comments])& 
    "&_fid_356=" & URLEncode ([Related Part Location Name])&
    "&_fid_24=" & URLEncode ([Defect Description])&

    "&z=" & Rurl()& "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])

    It adds, but i need it to add then edit.  


  • 11.  RE: Formula help

    Posted 04-05-2018 14:03
    In the your last line here

    "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])

    The a=dr means

    action equals to Display Record. (not  the new ACTIONs, but the action that you want the URL to do).

    if you make that a=er 

    than means action equals edit record.

    so just change the dr to er.