[Zope] Dynamic SQL statement construct

Nick Garcia ngarcia@codeit.com
Thu, 29 Jul 1999 10:29:29 -0700


At 08:46 AM 7/29/99 +0000, Paul Chung Chee Soong wrote:
>DTML Method 1 :-
>============
>   Contain 3 same combo box as the first, second and third sort key. Each   
>combo box contains   3 sort keys,  Aeg. A, B, C.
>   User will choose the combination of keys they want and submit the   
>page..
>
>DTML Method 2 :
>============
>Display the information as the sorted manner defined in the earlier page.
>
>
>So how do you guys think? Can Z SQL Method do that? The followings are   
>the possible key combinations:
>ABC
>ACB
>BAC
>BCA
>CAB
>CBA
>AB
>AC
>BA
>BC
>CA
>CB
>A
>B
>C
>
>Do we need to BUILD 15 Z SQL Method?? If not, what is the proper way?

You'll probably want to use something that looks like this in your SQL
Method to get the correct key combination:
<!--#if var1-->
  <!--#if var2-->
    <!--#if var3-->
      <!--#call "REQUEST.set('result', _.string.join([var1,var2,var3],''))"-->
    <!--#else-->
      <!--#call "REQUEST.set('result', _.string.join([var1,var2],''))"-->
    <!--#/if-->
  <!--#else-->
    <!--#if var3-->
      <!--#call "REQUEST.set('result', _.string.join([var1,var3],''))"-->
    <!--#else-->
      <!--#call "REQUEST.set('result', var1)"-->
    <!--#/if-->
  <!--#/if-->
<!--#else-->
  <!--#if var2-->
    <!--#if var3-->
      <!--#call "REQUEST.set('result', _.string.join([var2,var3],''))"-->
    <!--#else-->
      <!--#call "REQUEST.set('result', var2)"-->
    <!--#/if-->
  <!--#else-->
    <!--#if var3-->
      <!--#call "REQUEST.set('result', var3)"-->
    <!--#/if-->
  <!--#/if-->
<!--#/if-->

This probably isn't *exactly* what you need (and it's not very pretty), but
it should at least point you in the right direction.  Oh, and this will
also produce key combinations like: AAA,BBB,CCC,AAC, etc...



Nick Garcia | ngarcia@codeit.com
CodeIt Computing | http://codeit.com