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
    • 6 mths 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
    • 6 mths 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
      • 6 mths ago
      • Reported - view

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

    • francescostefanello
    • 6 mths 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
    • 6 mths 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
      • 6 mths ago
      • Reported - view

       I already corrected this, thanks a lot to you

      • Rafael Sanchis
      • Rafael_Sanchis
      • 6 mths ago
      • Reported - view

       Great Francesco 👍

    • francescostefanello
    • 6 mths 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
    • 6 mths ago
    • Reported - view

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

Content aside

  • Status Answered
  • 6 mths agoLast active
  • 9Replies
  • 112Views
  • 4 Following