Set multiple variables not setting values

I am trying to set multiple variables from data coming in via a webhook. I can confirm the data is in the webhook that is caught by looking in the output of that module.

However, the variables that are supposed to be set with this data are empty coming out of the set multiple variables module.

Here is what I’m doing to try to set these variables:

And the strange thing is that before I added these additional “raw” variables, I previously had this one that was working correctly. Now none of them work (all empty).

I can’t seem to figure out why these are not setting now. And there are no errors. The scenario continues and completes successfully.

Hello @Ryan3,

You can try removing double quotes around your text. Make doesn’t use those unless they’re actually part of the text. It’s a little backwards if you’re used to traditional scripting/programming.

Thanks for the heads up on that. Removing the quotes did fix the cleaning fee which is using the if statement, but not the damage waiver that’s using the switch. Is there a better way to check for that one? Or something I’m doing wrong with the switch statement?

The syntax on your switch() function doesn’t appear to be correct.
Switch is meant to take in one parameter, compare it to multiple potential values, then output something depending on which value was matched. Something like this:

switch(dayofweek;Mon;Monday;Tue;Tuesday;Wed;Wednesday;Thu;Thursday;Fri;Friday;Saturday or Sunday)

So if dayofweek from a previous module is Mon, then output Monday to the next module.
If none of Mon, Tue, Wed, Thu, or Fri, then output Saturday or Sunday (default) to the next module.

What am I missing then? In its current state, I’m checking the value of the fee label and if it equals “Resort Fee” or “Management Fee” then I output the value of the fee amount to be set to the variable damage_waiver_raw. Otherwise, leave the variable empty.

Or am I understanding my implementation wrong?

Sorry I didn’t look closely enough. The way the field is currently set up, it’s only grabbing the first item in the guest_fees array which results in “Cleaning Fee”. This would explain why linen_fee_raw isn’t matching anything either, if that’s also the case with linen fee.

You probably need to use the map() function on that guest_fees array to get your various fees.

With map(), you supply guest_fees as the array, you’ll want to get amount, where label is Cleaning Fee, Resort Fee or Linen Fee.

Something like this:
map(guest_fees[ ];amount;label;Cleaning Fee)

The result will be an array assuming where only 1 item in that array where label = Cleaning Fee.
Then you can use get() function to get the first (and probably only) item out of that array.

1 Like

Looks like map() got it all sorted out. Thanks!

1 Like