[TYPO3-project-formidable] How to perform user defined SQL queries?

François SCHOSSIG fs.nospam1 at a-e-r.org
Mon Dec 18 18:29:49 CET 2006


About the userdefined SQL-queries, you have several possibilities  
depending on what you want to do.
-> use a userobj in the renderlet depending on your query :
     <userobj>
       <php><![CDATA[
          // the SQL query that produces the right result
       ]]></php>
     </userobj>

-> you can modify several things (doing a sql query and modify  
things) while saving the form by using :
     <control>
       <datahandler:DB>
         <tablename>table_name</tablename>
         <keyname>key_name</keyname>
         <labelname>label_name</labelname>
         <process>
           <beforeinsertion>
             <userobj>
               <php><![CDATA[
// Your code
               ]]></php>
             </userobj>
           </beforeinsertion>
         </process>
       </datahandler:DB>

-> in a lister, you can reduce the result or by using a hidden field  
or by giving directly the sql code
     <search>
       <atstartup>true</atstartup>
       <sql>
         <wheres>
           <where>
             <term>fieldName1</term>
             <comparison><![CDATA[IN]]></comparison>
             <value>
               <userobj>
                 <php><![CDATA[return theValue1;]]></php>
               </userobj>
             </value>
           </where>
           <logic>AND</logic>
           <beginbrace />
           <where>
             <term>fieldName2</term>
             <comparison><![CDATA[IN]]></comparison>
             <value>
               <userobj>
                 <php><![CDATA[return theValue2;]]></php>
               </userobj>
             </value>
           </where>
           <logic>OR</logic>
           <where>
             <term>fieldName3</term>
             <comparison>=</comparison>
             <value>0</value>
           </where>
           <endbrace />
         </wheres>
       </sql>
     </search>

About the other things, Jérôme should answer directly.
--
F. SCHOSSIG, ICT Manager
Assemblée des Régions d'Europe
http://www.a-e-r.org


Le 18 déc. 06 à 17:59, Franz Werner a écrit :

> Hi,
>
> is it possible to perform userdefined SQL-queries when selecting data
> from and inserting data into a database?
>
> More specific: I would need to join several tables before  
> displaying the
> data. In its standard behavior formidable uses the form name to select
> the corresponding table, and the ids of the input elements to  
> select the
> corrensponding row.
>
> This seems to be no problem when using user defined renderlets for  
> list
> boxes etc. but I coudn't find an example in how to do the same with  
> the
> "HTML display list".
>
> And is there a possibility to insert data into serveral different  
> tables
>    when creating a new record in the database? I.e. I would like to
> validate all elements of a form and insert the data in two or more
> different tables.
>
> TIA,
> Franz.
> _______________________________________________
> TYPO3-project-formidable mailing list
> TYPO3-project-formidable at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project- 
> formidable



More information about the TYPO3-project-formidable mailing list