Announcement

Collapse
No announcement yet.

Help with retrieving the 'status' field in a formula

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with retrieving the 'status' field in a formula

    Hello once again, please, can someone tell me where the issue is in this forum? I can't retrieve the "status" field even though it exists in the information.

    PHP Code:



    $vacancesesIds 
    vacancesesIds;

    if (
    array\length($vacancesesIds) > 0) {
        
    $premierId array\at($vacancesesIds0);

        
    $informations json\encode(record\fetch('Vacances'$premierId));
       
    output\printLine($informations);
      
        if (
    array\length($informations"status")) {
            
    $status array\get($informations'status');
            
    output\printLine("The status associated with the ID is: $status");
            
        } else {
            
    output\printLine("The 'status' field is not present in the information.");
        }
    } else {
        
    output\printLine("The list of vacationIds is empty.");
    }

    ​ 

  • #2
    Hi,

    I can't find the documentation about the "get" function inside the "array" category.
    The "at" exists but not the "get" one.

    Are you sure you are using the correct function to get the "status" field inside your "Information ?


    Regards,
    Firyo.

    Comment


    • #3
      Not sure why you make it difficult using that code, i would do something like below:

      PHP Code:
      $vacancesesIds vacancesesIds;

      if (
      array\length($vacancesesIds) > 0) {
          
          
      $vanceId record\fetch('Vacances'array\at($vacancesesIds0));

          if (
      $vanceId) {
              
      $status object\get($vanceId'status');
          }
        
          if (
      $status) {
              
      output\printLine("The status associated with the ID is: ");
              
      output\print($status);
          }
          else
          {
              
      output\printLine("The 'status' field is not present in the information.");
          }
      }
      else {
          
      output\printLine("The list of vacationIds is empty.");
      }
      ​ 

      Comment


      • espcrm
        espcrm commented
        Editing a comment
        Curious, what the point of this?

        > $vacancesesIds = vacancesesIds;

      • rabii
        rabii commented
        Editing a comment
        Nothing just used it as he used it in the code. tbh it would be easier to just use vacancesesIds directly without assigning it to a variable.

      • espcrm
        espcrm commented
        Editing a comment
        Cool, I thought it was some hidden trick when using formula.

        Like you guys would just
        if ($vanceId) whereas me I would probably do something like this? if ($vanceId=='true')

    • #4
      Thank you, Rabiiii. You always remain an excellent teacher.

      Comment

      Working...
      X