best way to return number of hours

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • yberges
    replied
    that works 100000 thanks !

    Leave a comment:


  • lazovic
    replied
    yberges,

    Thank you for additional information.

    The following formula will work if:
    • Fields for days have the same option settings (meaning that each field has the same Non and Oui options);
    • The field for the Wednesday is (presumably) named inscMercrediEnum, otherwise, just replace this field in formula with the name of your field.
    Please try this formula and let me know if everything went well.​

    Code:
    ifThen(
    inscMardiEnum = 'Non' && inscMercrediEnum = 'Non' && inscrJeudiEnum​ = 'Non',
    nombreDheureDeFormation = '0h'
    );
    
    ifThen(
    inscMardiEnum = 'Non' && inscMercrediEnum = 'Non' && inscrJeudiEnum​ = 'Oui',
    nombreDheureDeFormation = '7h'
    );
    
    ifThen(
    inscMardiEnum = 'Non' && inscMercrediEnum = 'Oui' && inscrJeudiEnum​ = 'Non',
    nombreDheureDeFormation = '7h'
    );​
    
    ifThen(
    inscMardiEnum = 'Oui' && inscMercrediEnum = 'Non' && inscrJeudiEnum​ = 'Non',
    nombreDheureDeFormation = '7h'
    );​
    
    ifThen(
    inscMardiEnum = 'Oui' && inscMercrediEnum = 'Oui' && inscrJeudiEnum​ = 'Non',
    nombreDheureDeFormation = '14h'
    );​
    
    ifThen(
    inscMardiEnum = 'Oui' && inscMercrediEnum = 'Non' && inscrJeudiEnum​ = 'Oui',
    nombreDheureDeFormation = '14h'
    );​
    
    ifThen(
    inscMardiEnum = 'Non' && inscMercrediEnum = 'Oui' && inscrJeudiEnum​ = 'Oui',
    nombreDheureDeFormation = '14h'
    );​
    
    ifThen(
    inscMardiEnum = 'Oui' && inscMercrediEnum = 'Oui' && inscrJeudiEnum​ = 'Oui',
    nombreDheureDeFormation = '21h'
    );​

    Leave a comment:


  • yberges
    replied
    hello here the screenshot
    Click image for larger version

Name:	2023-02-01_11h10_08.png
Views:	268
Size:	43.3 KB
ID:	87697
    Click image for larger version

Name:	2023-02-01_11h10_24.png
Views:	227
Size:	47.2 KB
ID:	87698
    Thanks for your help

    Leave a comment:


  • lazovic
    replied
    yberges,

    Please show me the settings of your inscMardiEnum and nombreDheureDeFormation fields so that I can analyze in detail what could be wrong.

    Leave a comment:


  • yberges
    replied
    lazovic some return ?

    Leave a comment:


  • yberges
    replied
    hello
    a question because all return 0h
    Code:
    ifThen(
        array\includes(inscMardiEnum, 'day1'),
        nombreDheureDeFormation = '7h'
        );​
    taht say :
    if inscMardiEnum have value 'day1' nombreDheureDeFormation is equal to 7h
    or
    inscMardiEnum have a value ?
    inscMardiEnum is a dropdown with Yes or No value
    regards

    Leave a comment:


  • yberges
    replied
    Many thanks ! i will try

    Leave a comment:


  • lazovic
    replied
    Hi yberges,

    At the moment, I see one solution as follows: create a field of the Varchar type (for example, sumOfHours) and in the entity formula, add the following lines:
    Code:
    ifThen(
        array\includes(days, 'day1'),
        sumOfHours = '7h'
        );
    
    ifThen(
        array\includes(days, 'day2'),
        sumOfHours = '14h'
        );
    
    ifThen(
        array\includes(days, 'day3'),
        sumOfHours = '21h'
        );
    
    ifThen(
        array\includes(days, 'day1') && array\includes(days, 'day2'),
        sumOfHours = '21h'
        );
    
    ifThen(
        array\includes(days, 'day1') && array\includes(days, 'day3'),
        sumOfHours = '28h'
        );
    
    ifThen(
        array\includes(days, 'day2') && array\includes(days, 'day3'),
        sumOfHours = '35h'
        );
    
    ifThen(
        array\includes(days, 'day1') && array\includes(days, 'day2') && array\includes(days, 'day3'),
        sumOfHours = '42h'
        );
    
    ifThen(
        array\length(days) == 0,
        sumOfHours = '0h'
        );​
    Just don't forget to change the word days to the name of the field that stores day1, day2, day3 values. Also, it is very important that they are called that way in the field settings, otherwise they will need to be changed to the appropriate ones.​ Then just paste the placeholder for this field into the PDF Template.​

    If you have any difficulties or problems with this solution, or if you need to explain something, I will be happy to help you.

    Leave a comment:


  • yberges
    started a topic best way to return number of hours

    best way to return number of hours

    hello i try to create a pdf with an hour information
    1 i have 3 fields to day participation in my entity (day1, day2, day3)
    2 user can subscribe each day
    3 in my pdf template i need to display a sum of hours regarding days selected (1 day = 7h, 2 days = 14h, 3 days = 21h)
    thanks for helping
Working...