Forum Discussion

LB's avatar
LB
Qrew Cadet
3 months ago

Add button embedded report

Hello, 

I have a button in the embedded report to allow the user to quickly add an update with the current record. However, I don't want the button to add an update display if this record is considered closed and the user not add an update with a closed record - only add an update with a current active record. 

Is there a way to only have this button show in line with a current active record that needs to have update records added? Screen shot of the purple buttons in questions. 

 

  • When a URL formula field calculates to blank, then the button will be blank.  

    So just put a IF statement around  your URL formula and leave the alternative condition blank and the button will end up being blank. 

    Feel free to post back if you have trouble with the syntax for the IF statement.

    • LB's avatar
      LB
      Qrew Cadet

      Thanks for your reply. I'm starting from scratch on this and don't really know how to begin setting this up. Do I create a new field that is a URL formula field and then add the formula in that field that will trigger the button to display/not display?

  • LB's avatar
    LB
    Qrew Cadet

    URLRoot() & "db/" & [_DBID_BJS_YOUTH_UPDATES] & "?a=API_GenAddRecordForm&_fid_12=" & URLEncode ([Record ID#])& "&z=" & Rurl()

  • var text URL = URLRoot() & "db/" & [_DBID_BJS_YOUTH_UPDATES] & "?a=API_GenAddRecordForm&_fid_12=" & URLEncode ([Record ID#])& "&z=" & Rurl();

     

    IF([Status] <> "Closed", $URL)

     

    Of course I'm not exactly sure what your field names are for determining if the record is open or closed for editing, but you will get the idea from the formula above. You'll notice that the formula is silent as to what happens if the status is closed and that will cause the button to go blank.  

     

     

     

  • LB's avatar
    LB
    Qrew Cadet

    Thank you, so I add both formulas to the button field?

     

    • Well, if you want, you can leave your current field as it is but duplicate it to make a new button to get that working. Once it's working, you can remove the old button from the embedded report.  

      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend

        But sorry just to be clear that is the entire code and it all goes into the same button.

  • LB's avatar
    LB
    Qrew Cadet

    Ok, in the IF formula it's highlighting the $ yellow?

    and I essentially have 2 status options that consider a record closed, they are closed and transitioned to another facility. How would I incorporate both of those options?

     

  • LB's avatar
    LB
    Qrew Cadet

    It worked when I removed the space between the $ and URL and used $URL. I'm not sure how to incorporate the other option 

    • Thx, I corrected my post to remove the space.  I was typing on an iPad and it snuck in there.

      The syntax would be like this

      IF([Status] <> "Closed" and [Status] <> "Transitioned", $URL)

    • ... So, just by way of education, that's also would've worked

       

      IF(

      [Status] <> "Closed" and [Status] <> "Transitioned", 

      URLRoot() & "db/" & [_DBID_BJS_YOUTH_UPDATES] & "?a=API_GenAddRecordForm&_fid_12=" & URLEncode ([Record ID#])& "&z=" & Rurl()

      )

       

      But in my experience, you want to write these formulas so they are really really stupid simple to understand.  Sunday future you in three years from now will look back at a formula and try to remember what it was supposed to do or you may inherit a formula from somebody else or be passing it on to somebody else. So you want these formulas to be obvious.   Using formula variables can help do that.  Here is a link to help text.