You appear to know how to retrieve the data from a select query, @ABG's YAML example shows how to present the data in the format that you requested....
Do It Result: [[[obra, 1.1.22 COROADOS], [cliente, CONSDON ENGENHARIA E COMERCIO LTDA]], [[obra, 4.3.22 BURITIZAL], [cliente, NEOCOGEC]]]
CIDADE was just an example. The real field is CLIENTE. As you can see, there are two records and I am using ReturnColumnHeaders as TRUE.
So you want data to be presented in this format:
1.1.22 COROADOS
CONSDON ENGENHARIA E COMERCIO LTDA
__________________________________________
4.3.22 BURITIZAL
NEOCOGEC
__________________________________________
Yes, almost this. What I want to put in the listview is:
Obra - 1.1.22 COROADOS
Cliente - CONSDON ENGENHARIA E COMERCIO LTDA
__________________________________________
Obra - 4.3.22 BURITIZAL
Cliente - NEOCOGEC
__________________________________________
Got it.
Your download format is three dimensional, not fitting the usual table or dictionary patterns.
You might get it by coercing the lists of key,value pairs into dictionaries.
Some coding needed here.
The text you supplied is not parseable as JSON, because it lacks quotes.
It needs work upstream.
It can be handled with list blocks, as Sunny has shown....but the issue is there are no quotes around the strings....
Works if list is of this format.
If I remember correctly, sql queries return data in csv table format but this one is not.
I have just come to my senses.
You may need to use the listfixer block (as shown in the documentation...)
This should return a workable json array format
@vknow360 thank you for your suggestion... I'll try here and tell you my results.
@TIMAI2 thank you for point this... I am already using this block. Starting tests right now.
Guys, I'm almost there. Let me explain the situation now:
When I use SELECT obra, cliente FROM obras using the ListFixer block, my result is:
[["1.1.22 COROADOS", "CONSDON ENGENHARIA E COMERCIO LTDA"], ["4.3.22 BURITIZAL", "NEOCOGEC"]]
So, in this case, I have two records. But imagine the result could be four or five or more records. In this case how do I use the procedure explained by @vknow360 to make a join with string "Obra: " and "1.1.22 COROADOS" and "Cliente: " and "CONSDON ENGENHARIA E COMERCIO LTDA", once these strings ("Obra" and "Cliente") are not from the query result?
Use this procedure from my prior post:
It needs row 1 to contain the headers, though.
You can customize from here.
Are you not returning column headers ?
No. In this case it is not necessary.
Well it maybe if you want to display these in the listview ?
Alternatively, given you are somehow using these two words to build the select query, store these to variables, then they can be used to help build the listview.
It would really help (everyone!) if you stopped changing things after asking your initial question.
Ok, I'm sorry.
Therefore, assuming you are now using column headers, and your data is returned like so:
[[["obra", "1.1.22 COROADOS"], ["cliente", "CONSDON ENGENHARIA E COMERCIO LTDA"]], [["obra", "4.3.22 BURITIZAL"], ["cliente", "NEOCOGEC"]]]
These blocks should produce your listview as requested (remember to set the listview to Main text and Detail text (vertical) in the Designer, and you need a Web component for the JsonTextDecode block)
You can return as many records as you wish for these blocks
Thank you! That was the solution!!! And thanks to all who helped me on this!! I really apreciated.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.