0 votes


i would like to make a conditional command in ConsultCmdsTools.
I've made a query in consult query who give me field with "the good decision"
I've made a macro with a onfield based on these fields
the principe is working, if a simply put a text in result of my onfield, it's working good, but when i put a macro, nothing is displayed.

I've try to use delay, and or %%syntaxe, but it seems that there is no change,

I didn't find the good syntaxe.

Here is my query:

ConsultQueries.Proj {[
<%RunQuery(id="activeCatg", SQL="select pj.K_PROJECT, isNull(pjca.K_PROJECT, 0) as projCA, isNull(pjde.K_PROJECT, 0) as projDE
, isNull(pjtut.K_PROJECT, 0) as projTut, isNull(pjind.K_PROJECT, 0) as projInd
, isNull(pjca.K_PROJECT, 0) + isNull(pjtut.K_PROJECT, 0) as projCAorTUT
, isNull(pjind.K_PROJECT, 0) + isNull(pjtut.K_PROJECT, 0) as projINDorTUT
 from PROJECTS pj
                                     left join <#table name='PROJ$CA'> pjca on pj.K_PROJECT = pjca.K_PROJECT
                                     left join <#table name='PROJ$DONNEES_ENT'> pjde on pj.K_PROJECT = pjde.K_PROJECT
                                     left join <#table name='PROJ$TUTEUR'> pjtut on pj.K_PROJECT = pjtut.K_PROJECT
                                     left join <#table name='PROJ$PROG_INDIVI'> pjind on pj.K_PROJECT = pjind.K_PROJECT
                                     where pj.K_PROJECT = :param1", param1="#K", store="3")%>

here is my ConsultCmdsTools :

ConsultCmdsTools.Proj {[isCmdNewProjPif;isCmdEditProgResult]}
isCmdNewProjPif {[<%OnField('projCAorTUT', query="activeCatg", value='0', then='222', else='<%Macro("CmdNewProjPif")%>')%>]}
isCmdEditProgResult {[<%OnField('projINDorTUT', query="activeCatg", value='0', then='333', else='<%Macro("CmdEditProgResult")%>')%>]}
CmdNewProjPif {[<%Macro(name=$macro$, $_more$=$more$, $class$="", $icon$="i-Proj", $caption$="Ajouter un PIF", $msg$="editNewProjCA;pif")%>]}
CmdEditProgResult {[<%Macro(name=$macro$, $_more$=$more$, $class$="", $icon$="i-Proj", $caption$="Editer le résultat du programme", $msg$="editProgResult")%>]}

have you a idea of a good syntaxe to do that ?

PS: i'm in 2014 6100

asked in Efficy/ Client side by (336 points)

1 Answer

+1 vote
Best answer

Hi Vincent,

Because the consult command button macro's are part of a <%Macros()%> call, the pass through of the macro name is done with the $-variables. The macro that you nest inside does not have access to the parent $-variable definition and that's the reason why the macro doesn't do anything.

You can solve it by repeating the macro name="ConsultCmdsTemplate" inside the command macro.

Here is a simplified example where we only show a button for companies with CITY=Brussels.

ConsultCmdsTools.Comp      {[CmdMap;SwitchCmdBrussels]}

SwitchCmdBrussels {[<%OnField("CITY", value="Brussels", 

CmdBrussels {[<%Macro(name="ConsultCmdsTemplate", $_more$=T, 
  $icon$="i-wizard", $caption$="Located in Brussels", $msg$="", 



answered by (6.8k points)
selected by
thx, it's working good now, i did not think about that.
1,166 questions
1,424 answers
325 users