Templex in Response outputs ?

Clement_CAP
Clement_CAP Altair Community Member
edited July 2021 in Community Q&A

Hello,

I am currently working on hyperstudy and would like to integrate some 'if' statements in my output responses expressions.

Exemple :

 

{if(Masse_tot>1)}

  {r_46=45}

{else}

  {r_46=48488484}

{endif}

 

where Masse_tot is a existing output response and r_46 the output response associated to the templex formula i am trying to use.

 

Is there a way to include conditions statements in the expression builder of an output response ?

I did not manage to have a templex formula working for now...:(/emoticons/default_sad.png' srcset='/emoticons/sad@2x.png 2x' title=':(' width='20' />

 

Thanks for the answer,

 

 Clément

 

Answers

  • Diana_38240
    Diana_38240
    Altair Employee
    edited October 2020

    Hi,

    In case the request has not been answered yet you can find below two suggestions on how to define if function in the Expression builder.

    So, you have a response mass_tot(r_1) and you want to define r_2 in function of the value of r_1.

    To choose between two possible values, you can simply define r_2 with the following expression

    iffunc(r_1>1, 45, 48488484)   (it returns 45 if r_1 is >1, or 48488484 otherwise)

    For information, you can also define and register user functions to be used within HyperStudy Expression builder. Fon instance the same "if" function can be defined under Compose, and then registered for HyperStudyns. As a result user will appear in the Functions tab and you can use it to define r_2 as user(r_1)

    function f = user(mass)
        f=0;
        if mass>1
         f=45;
        else
         f=488888;
        end
    end

     

    Hope it helps.