Output on/off

Strange question about output options being on or off.

Wappler 3.9.9 on this particular project.
So I always understood in my mind that output being on or off was just for me to view the output of a step and had little bearing on the final result of a script.
I took a script which has been working fine for about a month, and turned off all the outputs on the steps, in my mind to make it more secure, and secondly because I am going to run it on a schedule, and figured, whats the point of outputting all the results if I will never see them anyway.

If I turn all the outputs on again the script works again, so not a big issue, just wondering why the output needs to be on.

Paul, the output option in the server actions is to pass the data/output to the front end. If the output is off, no data will be displayed on the front end from your database query for example.

1 Like

Yeah, thats the way I always understood it, however in my case this script is not linked to any front end at all, it just goes to one API and gets some results and adds them to my database as well as to another API as JSON data. So not seeing any of the outputs makes no difference to me, as long as the data is saved to my database and is sent to the other API. It is a totally background task, which is why i figured there was little need to have any output options set to true.

Just an update on this.

Because I am getting data from one API provider and their data is returned differently to what the receiving API is expecting, I have to use a few Set Value steps to replace some values.

As an example if I returned the JSON as the original is before modification I would have something like this

"priceOptions": [
    {
        "total": 850,
        "type": "Person"
    }
]

The receiving API is expecting the JSON to rather say

"priceOptions": [
    {
        "price": 850,
        "label": "Quantity"
    }
]

To do this I used Set Value steps with

{{customer_prototype.display_name.replace('Person', 'Quantity')}}

When the output of that step is off it sends Person to the receiving API, however when output is on then it returns Quantity as it should.

I just found it odd that Output Options had to be on for it to make the change, as I thought the change was made regardless of if I output or not.

From my experience, if the set value is in repeat, it sometimes needs output to be on. But that has been inconsistent.

Usually, as Teodor says, output on is required only if you want that step's value to be part of response.

1 Like

Mine is inside a repeat, and although there is no output needed to be displayed, I do have to keep the output on, or the formatters will not work, it will just use the initial value, so far it seems to be able to do math without output on, so (price / 100) works, but replacing words in a string, it can only do if I have the output option ON.

Seemed pretty strange, but not a real issue, was just concerned I had misunderstood how the output was supposed to work, which I do not think I have, this is just one of those odd things I will keep in the back of my mind.

Yep! I found this odd too, it does seem inconsistent and I am still no clearer when its ok to be on or off!

I don’t have an immediate use case. But if @psweb or @StevenM you guys have one, maybe Patrick could find the cause and give us some explaination. Or even better: a bug-fix. :smile:

1 Like