0

Query to update a specific value in a record on click/on trigger

How to I update a specific value of a field in a table.

 

I have a table named 'OpenRequirements' which has a field named 'status' which is set by selecting a value from table 'Status', so basically status is a reference from another table.

I am using a button 'Freeze' click on which I would like to change the status to 'Closed', however, when I use the code 

this.OpenRequirements.Status.status = closed, it actually changes the value in original table Status, however I want to just change the value for OpenRequirements table.

 

Please help understand how do I do that.

4 replies

null
    • Alain_Fontaine
    • 3 yrs ago
    • Reported - view

    Would this help you:

    let r := first((select Status)[Value = "Closed"]);
    this.(status := r)

    • Smita_More
    • 3 yrs ago
    • Reported - view

    Hey Thanks! It did work, only I had to change Value to status.

    Here is the correct code

     

    let r := first((select Status)[status = "Closed"]);
    this.(Status := r);

     

    However, further to that when I try to change the status in the reference table , it does not work. Code is as below:

    let r := first((select Status)[status = "Closed"]);
    this.(Status := r);
    let a := first(select TalentPool where 'Employee Name' like OpenRequirements.'Identified Candidate Name');
    let k := first((select Status)[status = "Closed"]);
    this.TalentPool.('Talent Pool Status' := k);
    void

     

    Please suggest.

    • Alain_Fontaine
    • 3 yrs ago
    • Reported - view

    >It did work, only I had to change Value to status.

    I did not know the name of the field containing the status values (now I know it is "status"), so I did put "Value" as a place holder.

    About the continuation of your procedure: as demonstrated by the Value/status confusion, it is difficult to debug something without the full context. Let's try to make some progress anyway.

    let k := first((select Status)[status = "Closed"]);

    This line is not needed, you can reuse the value of "r".

    this.TalentPool.('Talent Pool Status' := k);

    Without seeing the full context, I would venture to suggest that this could be what you need:

    a.('Talent Pool Status' := r);

    • Smita_More
    • 3 yrs ago
    • Reported - view

    Hey Thanks! It worked. Appreciate your help!!!

Content aside

  • 3 yrs agoLast active
  • 4Replies
  • 1533Views