Data binding not recognizing an array

Wappler Version : 2.6.3
Operating System : mac 10.15

Expected behavior

An array should be recognized in the data bindings, even if that array is a simple array of strings, etc.

Actual behavior

The array is seen as text.

How to reproduce

It seems like arrays with objects work fine, but a basic array of values does not.

Screen Shot 2020-03-10 at 11.09.47 AM

Screen Shot 2020-03-10 at 11.10.15 AM

How did you define the array?

Server connect, split of a text string

And it just a variable in server connect that you split and output?

Yep…

OK well currently the set value action always returns a single text value. It is’n aware that you have split it to s string.

Some background info:

In Server Connect action steps produce output, but to know what structure the output is, we collect it from the step action information. So queries return their records, repeaters return what they repeat etc.
We have defined before hand what each action can return, so we can determine the output metadata without really executing the action.

So of course when you really execute the action you will see the final real result, but we can’t do that in design time as we don’t want to run your action and for example insert records to your database just to see what the output is.

So we try to define before hand as much as possible what each step returns and construct this way the meta data of the whole server connect action. The output metadata is then stored in the same file and used for all the data pickers later on.

We use actually the same technique on the client side with App Connect - but there we have a bit more advanced version as we keep track not only of the output data but also of each variable and also the transformations done by the formatters that modify the metadata output. So in App Connect we know what when you apply the split on string you get an array out.

Unfortunately even with this new technique in the App Connect pickers, we still haven’t found the optimal solution for getting the meta data out of an expression. Because you will have to really run each expression to the data formatter dialog that analyzes the expression and returns the metadata. But if you just type the expression in the data picker, we still don’t have the meta data.

Also the formatters in App Connect are really dependent on the data type they are applied, while in Server Connect you can apply them on anything and you are responsive to choose the right type.

I hope it makes a bit sense :slight_smile:

But the bottom line is that we need a way to define the meta data of the variable output step.
We can go the App Connect route, but as I said even there it has a limitation as you have to go trough the formatters dialog each time.

Maybe a more simple solution will be to allow you to pick the output type yourself. That will work for simple data types, but not for more complex ones.

For complex data types we do have techniques like the schema editor that we use with the API connectors. There you can define your own output schema (meta data)

So conclusion: maybe we should just add a define schema button in the set value step - so you can enter your own output schema that can be picked later :slight_smile:

2 Likes

Hi @George,

Continuing this…I have a series of server action repeats that produce arrays along with a custom query that also produces an array. However in app connect there are not recognized as arrays. Shouldn’t a repeat and a custom query always produce an array?

They are shown as arrays in Data Bindings, but in Data Formats they are not.

Can you help with what I’m missing?

Screen Shot 2020-03-30 at 9.08.33 AM

I see the issue – the problem is that I am accessing these from Content Pages. Doing the same thing on the head page, everything works fine.

Can this be enhanced soon?

@George This hits me all day long. Any chance of addressing soon?