UI SQL: How to get the first item of a TextSelect

More
10 years 5 months ago #42703 by evolutiveMedia
Because good concepts are endless in time, I'm reconsidering returning to web development: Thanks to all the team for developing such a fantastic tool!

As you can suppose, I'm very new to FLEXI, infact I'm locked with the SQL writing conventions, for the 'TextSelect' field type.

I'm trying to get data from a previous field that is in the same record/item but no values are loaded into the combo. I don't find enough information on the web and I must admit that the tooltips are not helping me too much.

Here are the SQL queries:

1st FIELD: (it's working)
SELECT Provincia as value, Provincia as text FROM #__provincias

2nd Field: (Not working-I'm trying to get the previous field value)
SELECT Municipio as value, Municipio as text FROM #__municipios as m, #__provincias as p WHERE p.Provincia='field' and m.CodProv=p.CodProv

After some tests, I deduced the problem is in the 'field' spelling: '{item->fieldname}' but I can't even imagine what's wrong with it. I tried provincia, Provincia, item->provincia, item->Provincia, field->..., I tried '', {}, '{}', {{}} and more without success.

Do you know where is the problem? Is there another way to do that? Hope I gave you enough details.

Thank you for your great effort!

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #42774 by hede
Dont know if I understand your problem but as far as the field names are concerned you can find those in the field setup at the the label "Name", e.g. to retreive the field name of the core field "Document type" you would do $field->name and get document_type.

FF on Win10, FLEXIcontent version 3.0.10 on Joomla 3.4

Please Log in or Create an account to join the conversation.

More
10 years 5 months ago #42802 by ggppdk
Hello

in order to use values of a different field inside,

you have 2 choices
-- either use field replacements in the parameters
value prefix/value suffix/all value opentag/all values closetag

-- or if you want to use inside custom code the create a (NEW) custom FLEXIcontent field type (see our FAQ) and use:
Code:
echo "<pre>" .print_r($item->fieldvalues, true) ."</pre>";
to see what is available
e.g.
Code:
$item->fieldvalues[54]
contains the field values for field 54 of current item


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
10 years 4 months ago #42927 by evolutiveMedia
I got to know that I'm really trying to create "chained selects" but I didn't express myself clearly enough, sorry.

As far as I know, from reading your previous posts, the 'chained selects' capability was not implemented yet, though it's on your agenda.

Anyway, I found a temporary solution, which is working fine.

Thank you so much for your fast reply with helpful information.

Cheers!

Please Log in or Create an account to join the conversation.

More
10 years 4 months ago #42930 by evolutiveMedia

hede wrote: Dont know if I understand your problem but as far as the field names are concerned you can find those in the field setup at the the label "Name", e.g. to retreive the field name of the core field "Document type" you would do $field->name and get document_type.


Hi, Hede:

I was in a hurry and didn't express the problem correctly, sorry.

My problem was: How to make an SQL query that uses the content of a previously filled custom field (in the "back-end" interface). This feature is usually referenced as "chained select" but, in my case, I wanted to profit from the database, without using XML or JSON.

For example, given the following custom fields:

Text select 1 - country: [ select id as value, country as text from countries ]

Text select 2 - state: [ select state from states where country = {?} ]

How can the select1 field be scoped from field2 SQL query? I think it's not implemented yet, am I right?

Well, since then, I created a module with chained combos but, so far, they require a navigation through category levels, in order to update themselves. It's working fine but it's not applicable to the back-end where the comboboxes should operate in the same view/page, I mean, without web requests.

Anyway, thank you so much for your quickly sent helpful information!

Cheers!

Please Log in or Create an account to join the conversation.

More
10 years 2 months ago #44786 by evolutiveMedia

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.273 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline