0

Formula help

Hi to all!

 

i am trying to activate function through a formula to open specific record.

this is the formula:

 

html("<button class='customButton' onclick='openMaster()'>Open Master</button>
<script>
    function openMaster() {
        let xMasterID := 'Master ID';
        let x = first(select Master where 'Master Release Number' = xMasterID);
        openRecord(x);
    }
</script>

")

 

the same code on a button does correctly his function (that indicates that the problem is in the html syntax I suppose) but on that formula field doesn't work.

 

Can you suggest some corrections?

9 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 1 yr ago
    • Reported - view

    You can configure a formula field as a button too. (more options > On click)

    Or change the code to :

    let xMasterID := 'Master ID';
    let x = first(select Master where 'Master Release Number' = xMasterID);
    html(---<button class="customButton" onclick="ui.popupRecord('{ x }')">Open Master</button>---)
    
    • francescostefanello
    • 1 yr ago
    • Reported - view

    Thank you a lot.

    The formula worked for just one time, I edited it to assign to a string instead to a button, and when I started again with it, the SAME formula is not working (😐)

      • francescostefanello
      • 1 yr ago
      • Reported - view

       to avoid this problem I had just to write manually the first two lines and copy only the third line. 

    • francescostefanello
    • 1 yr ago
    • Reported - view

    can you suggest a way to open the record simply clicking to the string "Open Master" without creating a button?

     

    Thank you a lot 

    • John_Halls
    • 1 yr ago
    • Reported - view

    This line

    let x = first(select Master where 'Master Release Number' = xMasterID);
    

    should read

    let x := first(select Master where 'Master Release Number' = xMasterID);
    

    Hope that helps

    Regards John

      • francescostefanello
      • 1 yr ago
      • Reported - view

       I already corrected this, thanks a lot to you

      • Rafael Sanchis
      • Rafael_Sanchis
      • 1 yr ago
      • Reported - view

       Great Francesco 👍

    • francescostefanello
    • 1 yr ago
    • Reported - view

    done with AI support:

     

    <span onclick="ui.popupRecord('{ x }')"; style="color: #191970; cursor: pointer; text-decoration: underline;">({ x.xMasterID }) <br></span>

    • francescostefanello
    • 1 yr ago
    • Reported - view

    now the number 12676 is clickable and opens the Master Record related

Content aside

  • Status Answered
  • 1 yr agoLast active
  • 9Replies
  • 124Views
  • 4 Following