Working with multiple rows from Data Blaze

Hi again!
I have a snippet where I use Data Blaze to read multiple rows (usually 2-4).

I want my snippet to include a small table -- basically, it should reprint the rows pulled, though I only want some of the columns, not all.

I see how to use the {repeat} command to print each item in a list on its own line. But I'm not sure about working with multiple lists -- how would I output something like this:

Jane 29 female
John 29 male
etc?

Bonus question: outputting them in plain text like above would be OK - I can add delimiters for ease of reading - but in my ideal world, it would be a small table. Since I don't know how many rows the user will select, I don't know how many rows this table would be. Is it possible to generate it to the same number of rows as I've selected?

Hi @megan.gendell
I recorded a short video to show you how it's done. I hope this helps:

3 Likes

THAT IS SO COOL. Works great. Thank you!

1 Like

In case it's useful info for anyone else, a note:
Now I need to update my variable names elsewhere in the snippet
before: {=book[1]}
now: {=InsertedTable[1].book}
(I think I got that right)

Hi Dan - just wanted to follow up here- for some reason I am unable to view the video - it doesn't load in - would you mind sharing the code you wrote to accomplish this? Thank you

Oops. I deleted the video. Let's try doing this here:

{dbselect: SELECT Name, Count FROM Table1; space=id; menu=yes;multiple=yes;name=people}

{repeat: for row in people}{=row.name} {=row.count}
{endrepeat}

1 Like

Hi Dan, in the same general vein as your most recent response - is there a way to generate a table which shows all of the rows which correlate to a single name , so for example: If there were multiple "Bobs", how would I generate a table within my snippet which shows all of the Bobs and their corresponding ages

Thank you in Advance :slight_smile:

I figured it out from this post: Use data from DataBlaze - #2 by VinodGubbala

My next question is - How would I create an if/else formula if there is more than 1 row that pops up?

Using the same example:
I added. a filter to the DBSelect (Where Name="Bob") and removed the menu.
I'm using count(people) to determine the number of rows. (Poeple is the name of the output of the DBSelect command)

{dbselect: SELECT Name, Count FROM Table1 WHERE Name="Bob"; space=id; menu=no;multiple=yes;name=people}
There are {=count(people)} people with the name Bob
{if: count(people) > 1}There are multiple people with the name Bob{endif}

1 Like

Thank you Dan!