Reference Data in Datablaze Table and Pulling Variable Info

Hi TB community!

I am hoping to find an answer to my multiple part use case.

First- I am wanting to reference a property address in a DB table.

Typically the address will be stored in the DB table like this:
"3329 W 99th St, Cleveland, OH 44102"
But the software that I will be referencing (pulling website data from) with TB, usually only shows up like this:
"3329 W 99th St"

I have thought about "detracting" a certain number of characters so that the address is "boiled down" to the street address alone, but the number of characters before the street address is not always the same.

Would it be possible for this snippet to search that column of DB, and match with the address up "until" the first comma?
I am open to any suggestions.

The second part of my question/use case:
I am wanting to reference data within that same row of the property address.
For example:
If the one column/cell in that row is marked as "yes" then the snippet should show "I will please need past 4 months worth of a tenant rent ledger". If it is no/blank, then the snippet would leave it blank

So in conclusion: I would like to reference the DB table for the right address (without an exact match on the "full spelling") and then also reference a certain cell within that row to know whether or not to produce a certain output within the snippet

Best,
Andrew

Hi @ajduna7 and welcome to community!

Here is an example of Data Blaze space with Text Blaze snippet. You can try it by clicking on "Copy to Text Blaze" button - it will create space and connect a new snippet to it. The snippet will load all options from the table taking only part of address before first comma. Once you select the option you want, it will display value from boolean field of the selected row.

{dbselect: SELECT substring(Address, 1, search(Address, ",") - 1 if search(Address, ",") <> 0 else len(Address)) as short_address, Boolean FROM Table1; space=id; menu=yes; name=selected}
{=selected.boolean}

Thank you for the thoughtful Reply Mansour! This snippet seems to be working in limited fashion/possibly in reverse.

When the partial address is entered in my "searching" text box, then it does not pull up the address from DB, instead, as soon as I enter the full address (with city+state+zip) into the "searching" text box, it will then pull up the address within the "read from table" menu (but without the city+state+zip). Please see image attached.
scrnli_6_27_2024_7-24-51 PM

Furthermore- I would be curious to understand how to "alter" normal text that is "read" from DB. For example: (if the column is not a boolean, but instead a simple text field), would there be a way to have TB enter "Please send the past 4 months tenant rent ledger" if a specific cell is marked as "Occupied" (through searching for the property address, using the characters before the first comma)

Thank you so much for your Help :slight_smile:

From what I understand you prefer having address added through an input. I've added formtext where you can type address, it will match the address (you can add address partially), take status field value and depending on the value output "Please send the past 4 months tenant rent ledger".

{formtext: name=short}
{dbselect: SELECT Address, Status FROM Table1 where startswith(Address, @short); space=id; name=selected}
Address: {=selected.address}
{if: {=selected.status="Occupied"}}Please send the past 4 months tenant rent ledger{endif}

This worked amazing--- Thank you Mansur!! :grinning: