How to fix this value string in a table?

Can anybody help me with this value string for a query as a value added to a column in a table?

When I use just {{query22.data.street}} I can see that the array is correct. But then, it gets repeated in all rows.

When I use [0] or [i] it fixes the duplication, but the array is something else, with incorrect data.

What am I missing?

Can you try this and sure you select Source.

Not in this case.

That's because the source is the main table with most columns. But the column above is to take to this table a SQL query with join from other tables, hence the mapped array above.

If I use {{query22.data.street[i]}} it maps it but incorrectly. I can't figure out what is the index used in this case, as it doesn't match anything.

But the "652" Mapped array is in the correct order. Just can't map it to the column.

In this case, you will need to use something like the find function, but this is very expensive in terms of performance. I would recommend editing your query instead. If you give information about the other table, I will try to help.

This is the query I have now. The street and user_id output is correct.
Does it make sense?

The two tables do not match when using [i] because the rows in the two lists are not pulled in the same order.

You can try this if you have matching columns in two tables.

1 Like

Thanks so much @edurmush for your help with this! Much appreciated.

When you say matching columns in two tables, do you mean between the query output and the main table I am working on? If so, yes, I have user_id matching.

The two tables used in the join, changed the column name so now I have also two matching.

But still the new mapped value is not working...

Hello, the maybe have some problem of query22, could you share debug of it?

As i said before, you have to set Source for this column (in this case user_id)

item stands on current column value, when you dont set source, item is undefined

1 Like

here is the debug.. thanks again!

{{ _.find(formatDataAsArray(query22.data), { user_id: item }).street }}

This piece of code must work for you. You need to delete unnecessary curly brackets.

2 Likes

You are the best @edurmush !
Thanks so much for helping me with this.

1 Like