Using the same row in a Google Sheet for questions located on different pages of Retool

Coming in soon - needs a more detailed explanation :slight_smile:

since I'm getting it in line in my query, I need to do a transposition in column of what I could see except that I don't know how to do it

You have the detailed explanation here.

1 Like

Hello, I apologize for bothering you again, but since you have already helped me and I need assistance, I am reaching out to you. Let me explain my problem.

I am using a client's API, and they want to send an invitation email to their colleagues when the user enters their email addresses using the API. They want us to be able to send an email to up to 4 people. I have managed to do this when I send an email with all 4 people whose information is filled out correctly. However, if there is incorrect information for any of the 4 people, it does not work. I am unable to send an email for just 1, 2, or 3 individuals; I am required to fill out information for all 4. Could you please help me?

The loom for understand the problem :slight_smile:

Hey Dorian,

I think the issues is because you're passing empty values to endpoint and that's what is failing it.

You need to slightly modify the Body part of the code:

let result = []
if({{ email1.value.length>5&&role1.value.length>=2}}){
  result.push({role:{{ role1.value }},email:{{ email1.value }} })
}
if({{ email2.value.length>5&&role2.value.length>=2}}){
  result.push({role:{{ role1.value }},email:{{ email1.value }} })
}
if({{ email3.value.length>5&&role3.value.length>=2}}){
  result.push({role:{{ role1.value }},email:{{ email1.value }} })
}
if({{ email3.value.length>5&&role4.value.length>=2}}){
  result.push({role:{{ role1.value }},email:{{ email1.value }} })
}
return {usersToInvite:[result]}

That will remove values if unused and will pass only items where role.value.length>=2 and email length is greater than 5.

Hope this helps!

1 Like

It's on a body of an api query, how i call or use the transformer in the body?

Just reference transformer i.e. {{transformer.value2}} - does it work on your end?

1 Like

I test and i come back

Thank you so much, everything is working perfectly. I may reach out to you again in a few hours to ask for help, but really, thank you for everything.