0

Where is Working Phase Lookup????

Hello,
I have a button that I need to create a new record for each work phase of car assistance. The button reporting the data of the customer and the car to be repaired. So far so good but I can't in any way select the value of the work phase that I have to insert in the new record!

The values of the work phase are linked with a table and selected through a combobox!

Here I report the code. I've tried them all and I don't know how to continue ...

 

let currentRow := this;
let newPhase:= number(currentRow.Phase.WorkSequence) + 1;
let newWorkPhase:= (select CarWorkingPhase)[WorkSequence= number(newPhase)];
(create CarAssistance).(
    Customer:= currentRow.Clienti.ID;
    CarRegistry := currentRow.CarRegistry.ID;
    WorkingPhase = newWorkPhase
)

Thank you

4 replies

null
    • Garden Più
    • Mauro_Schiappelli
    • 2 yrs ago
    • Reported - view

    Fred Do you know solution for this problem? Thank You!

    In the new created record the Field WorkingPhase is null. But newWorkPhase contains value!!!

    If I use this formula, the desired value is not entered anyway.

    let newPhase:= number(currentRow.Phase.WorkSequence) + 1;
    let newWorkPhase:= (select CarWorkingPhase)[WorkSequence= number(newPhase)];
    (create CarAssistance).(
        Customer:= currentRow.Clienti.ID;
        CarRegistry := currentRow.CarRegistry.ID;
        WorkingPhase = newWorkPhase.ID
    )

    How should I do?

    • Fred
    • 2 yrs ago
    • Reported - view
    Mauro Schiappelli said:
    In the new created record the Field WorkingPhase is null. But newWorkPhase contains value!!!

     That was my first question. If you put:

    let currentRow := this;
    let newPhase:= number(currentRow.Phase.WorkSequence) + 1;
    let newWorkPhase:= (select CarWorkingPhase)[WorkSequence= number(newPhase)];
    concat(newWorkPhase)

    in to a formula by itself, do you see the appropriate record Id from the CarWorkingPhase table?

    Maybe you can try:

    let newWorkPhase:= first((select CarWorkingPhase)[WorkSequence= number(newPhase)]);
    

    Also I'm surprised the other reference fields fill in properly since ID is not what Ninox uses to refer to the record Id (note lowercase "d").

    let currentRow := this;
    let newPhase:= number(currentRow.Phase.WorkSequence) + 1;
    let newWorkPhase:= (select CarWorkingPhase)[WorkSequence= number(newPhase)];
    (create CarAssistance).(
        Customer:= currentRow.Clienti;
        CarRegistry := currentRow.CarRegistry;
        WorkingPhase = newWorkPhase
    )

    If Clienti and CarRegistry are reference fields then there is no need to use Id you can just point to the reference field and Ninox will do the proper linking. That is why I'm wondering if you get a proper Ninox record Id in newWorkPhase.

    Can you post a copy of your test DB?

      • Garden Più
      • Mauro_Schiappelli
      • 2 yrs ago
      • Reported - view

       Fred 

      Hi Fred, thanks for your support.
      Everything was fine but ninox makes me update the data correctly only after creating the new line and then I solved it like this ...

      let currentRow := this;
      let newPhase:= number(currentRow.Phase.WorkSequence) + 1;
      let newWorkPhase:= (select CarWorkingPhase)[WorkSequence= number(newPhase)];
      let newrow := (create CarAssistance);
      newRow.WorkingPhase := newWorkPhase;

      not even I can give me an explanation. Maybe you can know why.

      As for ID, I understand your suggestion and will try to let ninox put the correct references but I can assure you that in my case ID I can write everything in uppercase and the ninox compiler writes it to me just like that (I don't know if it's a question of language settings)

      • Fred
      • 2 yrs ago
      • Reported - view

      I've always use a variable when using the create command. I think it helps Ninox keep track of the new record better.

      I've seen people not use in other formulas, so I didn't think anything of it in yours.

Content aside

  • 2 yrs agoLast active
  • 4Replies
  • 60Views
  • 2 Following