Announcement

Collapse
No announcement yet.

help with a syntax formula

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

  • help with a syntax formula

    Hello friends, please, I need to update this record (formationsIds = typeFormation.formationsIds ) but with the following condition: if the (formationsNames) contains the term "Valide."
    Last edited by yuri; 11-18-2023, 12:32 PM.

  • #2

    I tried that, but it doesn't work
    ifThen(formationsNames == string\contains(formationsNames, 'Valide'), entity\setAttribute('formationsIds', typeFormation.formationsIds));

    Comment


    • #3
      That would not work string/contains search in a string and formationsNames is an array. If valide is a name of the formation record you can try code below:

      PHP Code:
      if (array\length(formationsIds) > 0) {
          
          
      $i 0;
          
          while(
      $i array\length(formationsIds)) {
              
      $name record\attribute('Formation'array\at(formationsIds$i), 'name');
              
              if (
      string\contains($name'Valide')) {
                  
                  
      entity\addLinkMultipleId('formations'array\at(formationsIds$i));
              }
              
              
      $i $i 1;
          }
      }
      ​ 
      Rabii
      Web Dev

      Comment


      • #4
        Hello Rabii, thank you for your help. Indeed, your code found the 3 records, but it didn't manage to find one with the name "valide".
        Attached Files

        Comment


        • #5
          I tried that too.

          PHP Code:

          if (array\length(classe.formationsIds) > 0) {
              
              
          $i 0;
              
              while(
          $i array\length(classe.formationsIds)) {
                  
          $name record\attribute('Formations'array\at(classe.formationsIds$i), 'name');
                  
                  if (
          string\contains($name'Valide')) {
                      
          entity\setAttribute('Meeting'$i);
                  }
                  
          $i $i 1;
              }

          My idea here is to only join the training sessions that contain the word 'Valid' in the 'Meeting' recording.
          Attached Files

          Comment


          • #6
            I need to know what are the entities involved and relationship between them for me to help. which entity is the target entity etc?
            Rabii
            Web Dev

            Comment


            • #7
              Originally posted by abidoss View Post
              Hello Rabii, thank you for your help. Indeed, your code found the 3 records, but it didn't manage to find one with the name "valide".
              PHP Code:
              $name record\attribute('Formations'array\at(classe.formationsIds$i), 'name'); 

              Formations ??? it should be single - name of the entity should be always single.
              Rabii
              Web Dev

              Comment

              Working...
              X