You can display certain data in another field related?

crchaves

New Member
You can display certain data in another field related?

example.

Country: Costa Rica

Location: San Jose, Alajuela, Cartago, Heredia, etc

I just want to see the towns of Costa Rica, in this field I have other locations in other countries.

It is possible?

other example

CENADA is located in Heredia and the area is Heredia

can automatically display these fields with the data even from another table ?
 

Attachments

  • image1.jpg
    image1.jpg
    263.1 KB · Views: 188
another question, in the form, I want the field name appears, but is in another table where I use to add "databasejoin".

example

locality table

id = 2
name = Alajuela

area table

id = 8
name = San Ramon
id_locality = 2

Marketplace table

id = 1
name = wal mart
id_locality = 2 "databasejoin complement = Alajuela"
id_area = 8 "databasejoin complement = San Ramon"

all these tables are fine.

now, this is what shows the last table

market product table

market rate = 4 databasejoin = Automercado
market = 9 CascadingDropdown = Wal mart
locality = 2 CascadingDropdown = 2
area = 8 CascadingDropdown = 8

I want to put the field name even if the value of the id, is it possible?

Regards !
 

Attachments

  • image2.jpg
    image2.jpg
    350.7 KB · Views: 155
Yeah, that happens when the label you want to use in the join'ed table is itself a join element, so the name isn't in the joined table, it's in yet another table.

In those cases, you have to use a subquery in the join (or CDD's) 'CONCAT Label'. So (say) on your 'area' CDD, you would use a CONCAT like this for you locality element:

Code:
SELECT name FROM locality WHERE id = {thistable}.locality_id

So instead of just rendering the locality_id as the label, it does a subquery on the locality table, and grabs the 'name' for that locality_id.

-- hugh
 
thanks for the support.

and wrote the query, but fails.

You can tell me I'm doing wrong?
 

Attachments

  • image3.jpg
    image3.jpg
    142.2 KB · Views: 168
Leave {thistable} exactly as-is, don't change it. That's a special placeholder we replace with the alias we are currently using for the joined table.

The reason we have to do that is, if you have more than one join to the same table, we have to use join aliases, like "LEFT JOIN foo AS foo_0 ... LEFT JOIN foo AS foo_1 ...". And those aliases aren't known until the query runs.

So we use the {thistable} placeholder, and replace it with the appropriate alias for the joined table, at the time the query runs.

-- hugh
 
thanks for your support.

I get an error

I put the code but do not know if it is correct

attached images
 

Attachments

  • image7.jpg
    image7.jpg
    181.9 KB · Views: 142
  • image6.jpg
    image6.jpg
    702.2 KB · Views: 173
I suspect it needs to be "WHERE id = ...", as per my first post, not "WHERE id_localidad = ". That needs to be the field your main join uses as the value.

Think about what this line is doing. It's taking the value of the {thistable}.id_localidad, i.e. your join element's selected value, and looking that value up in the table you join to, so it can retrieve the name associated with that id. So the field on the localidad table you are looking up, has to be the same field your join uses as the 'value'. Which is almost always 'id' (the Primary Key), if it's a table you created from within Fabrik.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top