How to get real data from encoded numbers

hi again,
I have some data having encoded numbers in place of string values coming from a webhook. and another data specifying the string values for those keys. Is there any way to convert it into real text? any help would be appreciated.

image

Hey @Nickk

You can use switch function for text type fields and for arrays, you can join by “,” and replace with the “string” values.

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support | Book Live Implementation
Visit us here
Youtube Channel

Hello,

Can you give more details about how is formatted the data that contains the string equivalent of the codes you receive from the webhook?

Can you tell us where the data the from the screenshot comes from? Is it an array with all the codes that your webhook receives? In that case, do you want to convert codes (9001, 9014, 9007,…) with a string?

And, what format should the output be like?

As @Msquare_Automation mentioned, there are ways to manipulate arrays and strings, but the choice will depend on the input and output formats.

Cheers

Benjamin

2 Likes

My data with actual string values is in same format as it showing in webhook. The only thing is it is in numbers. Like 9001 has some value Upcoming, 9002 has some value scheduled. Data coming in webhook is correct but I don’t know how to get same data with string values instead of numbers.

@Msquare_Automation I don’t know how to use switch or any function so I get same webhook data with actual values.

Hey!

What @Msquare_Automation is telling is that you can use a switch function (or module) to have a corresponding text according to the value of a field.

Example:

It’s very useful if your list of value/text is not too big and doesn’t change much.

But that’s not enough, because the way you use the modules and functions are dependent of the data you have and the data you want to get.
For instance, you gave us the format of the data you get when your webhook is called, and if you just want to pick field 1019 and map the corresponding value to another field, you can use the switch function.
But if you want to build a new document with a different format, you may need to do some extra steps.

So, what do you want to build? For example, do you want to build the exact same structure, but with text instead of numbers, or do you want to call an API and map some of the fields from the webhook, etc.
Can you also show the other data that contains the string values for the keys?

Benjamin

3 Likes

@Benjamin_from_Make

as you said is right. I want exact same structure with text instead of numbers. I used switch function as you told and it gives me the text values but I don’t know what should be the next step to get the same structure with text values.

1 Like

Yes, that’s why I was asking you the question :blush:

You have to build the target structure, even if it’s the same. Is it possible for you send send an example of the document your webhook receives? Like this I can show you the steps.

Benjamin

1 Like

Hey @Nickk

If I’m not getting you wrong, you want the data whatever you have in webhook exactly same with text values instead of numbers as @Benjamin_from_Make figured it out?? If this is the case, you can use “aggregate to JSON” module. Please follow the below steps to do so:

  1. Download the output JSON from webhook and copy.

image

  1. Attach “Aggregate to JSON” module and click on “Add” button to create the structure. Please select the source module as “webhook” in JSON module.

  1. Click on “Generate” button and paste your copied JSON in Sample data field.

  1. Attach a “Parse JSON” module and paste the output of “aggregate to JSON” module.

There is one crucial step in this process. in “aggregate to JSON” module, you will need to map everything from webhook and for the numbers, you will need to use switch/ join + replace functions with the text values as @Benjamin_from_Make shared the reference of use case.

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support | Book Live Implementation
Visit us here
Youtube Channel

2 Likes