How do I convert the array {100, 200, 300} to {0, 100, 200}

What are you trying to achieve?

Hello!

I am writing this post to ask for help from the wonderful members of the community while using Make.

What I want to implement seems to be complicated to explain, so I will keep it simple.

Using the add function in set variable, I want to subtract 100 from each value in the array {100,200,300}—the array name is price.

Subtract 100 from each value in the array {100,200,300}

I want to obtain the array {0,100,200} as a result.

Originally, when parseNumber was included in map(), an error message appeared saying that e should not be included, but this time that is not the case.

Please help me. ㅜㅜ Thank you.

Steps taken so far

I tried putting things in the map() function, but that didn’t work.
Subtracting a number from an array seems to result in a call to NaN, so that doesn’t seem to be possible either

I’m using iretator - text aggregator to create an array.

The problem is that arrays created before iretator can’t be referenced in add a raw ㅜㅜ

Hi @Korean ,
I haven’t tested this, but I believe it should work:
map(yourArray; i; add(parseNumber(i); -100))
This will subtract 100 from each value in the array.

Hope this helps!

@llirik @Iosif_Castrucci

I was not able to solve this with map(). I apologize for not being able to help.

Below is the process and results we went through.

Take an array {100,200,300} (array values are all numbers)

  1. map(testArray; item; add(item; -100)) >> Failed to map ‘value’: Function ‘map’ finished with error! Function ‘add’ finished with error! ‘item’ is not a valid array.
  2. {{map(150.testArray; “item”; item - 100)} >> {100,200,300}
  3. {{map(150.testArray; “item - 100”)}} >> {100,200,300}

It’s not solved, but I’ve learned a lot from your help.

I solved this with an iterator and a text aggregator.

thank you for your helping! I wish you all the best! I will work harder and be someone who can help users.

1 Like