cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HSIMOES
Frequent Visitor

COMO TRATAR UMA VARIÁVEL QUE VEIO VAZIA DO FORMS

Portuguese (Brazil):

 

Tenho um fluxo para envio de e-mail, em que o intuito é enviar um resumo das respostas de um formulário do microsoft forms.

 

Nesse resumo utilizo funções matemáticas como "add", "div" no corpo do e-mail, e quando a variável que utilizarei nessa função vem vazia do forms (não foi preenchida) o meu fluxo é interrompido pelo erro:

 

"Não foi possível processar as expressões de linguagem do modelo nas entradas 'Enviar_uma_notificação_por_email_(V3)' da ação na linha '1' e na coluna '44086': 'A função da linguagem do modelo 'int' foi chamada com um parâmetro que não é válido. O valor não pode ser convertido para o tipo de destino.'."

 

Utilizo a função "int" dentro das funções matemáticas para transformar o formato da variável, e quando a variável não é preenchida no forms, é gerado o erro acima. 

 

Exemplo da função: add(int(VARIÁVEL FORMS),2)

 

O que eu devo fazer?

Tenho mais de 20 variáveis pra tratar da mesma forma no e-mail.

1 ACCEPTED SOLUTION

Accepted Solutions
eric-cheng
Solution Sage
Solution Sage

Hi @HSIMOES ,

 

Use the IF() function e.g.

 

IF(condition, true value, false value). 

 

The below example checks if your FORM VARIABLE is empty ( you could also check for null ) and only proceeds to cast it as an integer if it is not empty.  Else, it sets it as 0.  You can modify it for your needs.

 

if(equals(FORMS VARIABLE, ''),0,int(FORMS VARIABLE))

 

You can read more about IF(), here.

--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up

View solution in original post

2 REPLIES 2
eric-cheng
Solution Sage
Solution Sage

Hi @HSIMOES ,

 

Use the IF() function e.g.

 

IF(condition, true value, false value). 

 

The below example checks if your FORM VARIABLE is empty ( you could also check for null ) and only proceeds to cast it as an integer if it is not empty.  Else, it sets it as 0.  You can modify it for your needs.

 

if(equals(FORMS VARIABLE, ''),0,int(FORMS VARIABLE))

 

You can read more about IF(), here.

--------------------------------------------------------------------------
If I have answered your question, please mark my post as a solution
If you have found my response helpful, please give it a thumbs up

@eric-cheng Your answer worked! Thank you!

 

But as there are many variables, I would like to know if there is a more practical way to do this.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

Carousel_PP_768x460_Wave2 (1).png

2022 Release Wave 2 Plan

Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (5,424)