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

Using [Collection] in HTML descriptor

mrajih
Super Contributor

Hello,

 

I'm trying to build a table with data about diagrams status, in an HTML descriptor.

 

For each diagramtype with at least 1 diagam available, I display the total first, then the diagrams number by status.

 

But something is wrong !

 

My code so far :

 

\n	[Component=DiagramType Id="Diag"]

\n		[Collection="Select [Diagramme] Where [Type de diagramme].[Nom] &name" ParentId="Diag"]
\n			[If="Cardinal>=1"]
\n				<tr>
\n					<td>[ComponentProperty="Nom court" ParentId="Diag"/]</td>
\n					<td>[CollectionProperty=Cardinal/]</td>
\n					<td>[Collection="Select [Diagramme] Where [Etat objet] = 'EE' And [Type de diagramme].[Nom] &name" ParentId="Diag"][CollectionProperty=Cardinal/][/Collection]</td>
\n					<td>[Collection="Select [Diagramme] Where [Etat objet] = 'EV' And [Type de diagramme].[Nom] &name" ParentId="Diag"][CollectionProperty=Cardinal/][/Collection]</td>
\n					<td>[Collection="Select [Diagramme] Where [Etat objet] = 'PE' And [Type de diagramme].[Nom] &name" ParentId="Diag"][CollectionProperty=Cardinal/][/Collection]</td>
\n					<td>[Collection="Select [Diagramme] Where [Etat objet] = 'PM' And [Type de diagramme].[Nom] &name" ParentId="Diag"][CollectionProperty=Cardinal/][/Collection]</td>
\n				</tr>
\n			[/If]
\n		[/Collection]
\n	[/Component]

Thank for your help

Mehdi

5 Replies

mrajih
Super Contributor

Perfect !!

Problem solved.

 

Thank you very much for your help.

Mehdi

Hi Mehdi,

 

the problem is that the names of your DiagramTypes do not exist in French (except if you created new ones and named them in French 🙂

The name you are talking about is the french value for the MetaAttributeValue linked to your DiagramType 🙂

It's a little complicated, but you could, for example, have it like this :

\n	[Component=DiagramType Id="Diag"]

\n		[Collection="Select [Diagramme] Where [Type de diagramme].[Nom] &name" ParentId="Diag"]
\n			[If="Cardinal>=1"]
\n				<tr>
\n					<td>[C="MetaAttributeValue" parentid="Diag"][C="Language" id=lang][CP=Nom If="Value=Français"][CP="Valeur externe" parentid=lang/][/CP][/C][/C]</td>
\n					<td>[CollectionProperty=Cardinal/]</td>
\n					<td>[Collection="Select [Diagramme] Where [Etat objet] = 'EE' And [Type de diagramme].[Nom] &name" ParentId="Diag"][CollectionProperty=Cardinal/][/Collection]</td>
\n					<td>[Collection="Select [Diagramme] Where [Etat objet] = 'EV' And [Type de diagramme].[Nom] &name" ParentId="Diag"][CollectionProperty=Cardinal/][/Collection]</td>
\n					<td>[Collection="Select [Diagramme] Where [Etat objet] = 'PE' And [Type de diagramme].[Nom] &name" ParentId="Diag"][CollectionProperty=Cardinal/][/Collection]</td>
\n					<td>[Collection="Select [Diagramme] Where [Etat objet] = 'PM' And [Type de diagramme].[Nom] &name" ParentId="Diag"][CollectionProperty=Cardinal/][/Collection]</td>
\n				</tr>
\n			[/If]
\n		[/Collection]
\n	[/Component]

There might be easier way, but I can't think of one right now 🙂

 

Regards,

 

Lionel

mrajih
Super Contributor

Thank you Jerome for these information.

 

Lionel, your modification made the code work !!

As you told me, I changed the first Component :

Before :

[Component=DiagramType Id="Diag"]

After : 

[Component="Select DiagramType" Id="Diag"]

 

One last question, I got the Diagramtype list in English, even if my environment is in French only. Is there a parameter that I can add the code to get the correct language ?

 

Thank you very much for your help

Mehdi

lionel
MEGA
MEGA

Hello Mehdi,

 

You do not give much details with "something is wrong"...

Do you have an error message ? Do you get an empty page ? What is the entry point of your descriptor ?

Whithout those "details", we can just guess 🙂

So I guess the problem comes from the [Component=DiagramType Id="diag"] (that depends of the entry point...)

Try to start with : [Component="Select DiagramType" Id="diag"]

 

Regards

 

Lionel

 

jhorber
MEGA
MEGA

Hello mrajih

 

Note that for complex code, it can be wise to call a macro. the macro can generate html code using API script and return it to the HTML descriptor

See this KB http://community.mega.com/t5/custom/page/page-id/mega-kb-solution?sid=50120000000mr25AAA

Jerome