cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using HTML buffers inside [Component]

mrajih
Super Contributor

Hello

 

I would like to create an html index of object "table", but with only one occurrence of a table, if the short name is not unique.

 

Ex :

Table1 : Name::ShortName = DB1::Table1 & DB2::Table1 & DB3::Table1 ...

Will be listed like : Table1 ShortName | DB1 , DB2, DB3 | comment

 

The objective is to have only 1 line by shortname to describe the same table, and list all the DBs where this table ShortName is related.

 

So far, I have tried many possibilities but no success.

 

Is it possible to have something like this using buffers ? 

----------------------------------------------------------------------------------------------------------------
   [Component="Select [Table]" Sorter="Nom court:A" WithPages=Yes]       
         [Buffer=nomcourt Set][ComponentProperty="Nom court"/][/Buffer]

         [Component="Select [Table] where [Nom court] [Buffer="nomcourt" Get/]"]

             <tr>

                  <td><img src="[ObjectPicture/]"/> [ComponentProperty="Nom court"/]</td>

                  …

----------------------------------------------------------------------------------------------------------------

 

Thank you

Mehdi

2 Replies

mrajih
Super Contributor

Hello Lionel

 

Excellent solution, it solves my problem.

 

Thank you very much !

 

Mehdi

lionel
MEGA
MEGA

Hello Mehdi,

it is not possible to use the content of a buffer this way.
But there is a solution ! 🙂
Since  you sort your tables by shortnames, you can use Buffers to compare each name with the precedent.
Your code should then look like this :

 

 

[Buffer="tmp, cpt, nomcourt"] 
[Buffer=tmp Set=""/] \c initialize buffer to empty value
[Buffer=cpt Set=0/]
[Component="Select [Table]" Sorter="Nom court:A" withpages=yes id=table]
  [If=First]<table border=1>[/If] \c Creation of the table
  [Buffer=nomcourt Set][ComponentProperty="Nom court"/][/Buffer]
  [If="Buffer(tmp)=Buffer(nomcourt)"]
    \c Shortname is the same as the previous one, we just add the database name to the last cell...
    <li>[C="Base-de-Données" parentid=table][CP="Nom court" Link=Out/][/C]
  [/If]
  [If="Buffer(tmp)!=Buffer(nomcourt)"] \c If shortname different from the previous one
    [Buffer=tmp Set][CP="Nom court"/][/Buffer] \c store the value in tmp for next compare
    [Buffer=Cpt Set][Value Expression="buffer(cpt) + 1"/][/Buffer] \c increase the cpt value to know when to close line (not for the first table...)
    [If="Buffer(cpt)>1"]</td></tr>[/If] \c If we are at least at the second table with a different short name, we need to close the first line of the table...
    \c Creation of the first line with a cell with the shorname of the table (no link...) and a cell with the first database (link)
    <tr>
      <td><img src="[ObjectPicture/]"/> [ComponentProperty="Nom court" parentid=table/]</td>
      <td><li>[C="Base-de-Données" parentid=table][CP="Nom court" Link=Out/][/C]
    [If=Last]</td></tr></table>[/If]
  [/If]
[/Component]
[/Buffer]

Hope that helps !

 

Lionel