Le forum (ô combien francophone) des utilisateurs de Powerbuilder.
BOnjour, écoutant vos conseils je me suis retranché sur une FreeForm Datawindow et je vais essayer d'ajouter des colonnes dynamiquement etc etc
Cependant, je voudrais ne pas afficher certains champs dans certains cas, j'ai essayé le code ci-dessous et j'ai une erreur de type "external object"
dw_planning.object.consultants_consultant_id[ll_i].visible = 0
Dernière modification par johnpelu (26-11-2008 15:05:37)
Hors ligne
J'ai remarqué qu'en faisant
dw_planning.object.consultants_consultant_id.visible = 0
ils disparaissaient tous, mais ce n'est pas ce que je veux
Hors ligne
il faut ajouter une colonne virtuelle de type numérique (0/1) avec un alias consultant_visible par exemple, mettre dans la propriété visible du champ l'expression consultant_visible, ensuite via code tu fais selon le cas
dw_planning.SetItem( no_ligne, 'consultant_visible', 0 ) // ou dw_planning.SetItem( no_ligne, 'consultant_visible', 1 )
Hors ligne
Ok, mais comment je fais pour ajouter/créer cette fameuse colonne virtuelle ? Dans l'Edit Source de la DataWindow ?
Hors ligne
Comme pour le cas de la discussion précédente, tu peux utiliser une colonne virtuelle (en FreeForm c'est posible).
Admettons que tu est une colonne que tu appelle col_visible de type numérique
Dans la propriété visible de ta colonne "consultants_consultant_id" il faut mettre une condition du type :
If(col_visible =1 ,0,1)
Ensuite au niveau de ton code PB tu applique la valeur 1 ou 0 à ta ligne suivant que tu veux la rendre visible ou pas
Hors ligne
Oui mais comment je dois faire pour créer cette fameuse colonne virtuelle ? Ca se crée ou ?
Hors ligne
nico a écrit:
Dans la propriété visible de ta colonne "consultants_consultant_id" il faut mettre une condition du type :
Code: pb
If(col_visible =1 ,0,1)
ton if est inversé
de toute façon c'est pas la peine de faire un IF 1=1 THEN 1 ELSE 0, la valeur directe du champ suffit
Hors ligne
johnpelu a écrit:
Oui mais comment je dois faire pour créer cette fameuse colonne virtuelle ? Ca se crée ou ?
Dans le source de la dw:
SELECT 0 as "virtual_number", '' as "virtual_varchar", ...
Hors ligne
johnpelu a écrit:
Oui mais comment je dois faire pour créer cette fameuse colonne virtuelle ? Ca se crée ou ?
de la même façon que tu crées les autres colonnes... à part que celle-ci tu la mets en invisible
Hors ligne
foon a écrit:
johnpelu a écrit:
Oui mais comment je dois faire pour créer cette fameuse colonne virtuelle ? Ca se crée ou ?
Dans le source de la dw:
Code: sql
SELECT 0 as "virtual_number", '' as "virtual_varchar", ...
c'est une DW dynamique, je suppose qu'il n'y a pas de requête derrière
Hors ligne
Oups pour l'inversion, mais j'ai fais vite
Hors ligne
Ca ne marche pas j'ai une erreur quand j'ai edité le source de la DW
release 11.5; datawindow(units=0 timer_interval=0 color=1073741824 brushmode=0 transparency=0 gradient.angle=0 gradient.color=8421504 gradient.focus=0 gradient.repetition.count=0 gradient.repetition.length=100 gradient.repetition.mode=0 gradient.scale=100 gradient.spread=100 gradient.transparency=0 picture.blur=0 picture.clip.bottom=0 picture.clip.left=0 picture.clip.right=0 picture.clip.top=0 picture.mode=0 picture.scale.x=100 picture.scale.y=100 picture.transparency=0 processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes print.background=no print.preview.background=no print.preview.outline=yes hidegrayline=no showbackcoloronxp=no picture.file="" ) header(height=0 color="536870912" transparency="0" gradient.color="8421504" gradient.transparency="0" gradient.angle="0" brushmode="0" gradient.repetition.mode="0" gradient.repetition.count="0" gradient.repetition.length="100" gradient.focus="0" gradient.scale="100" gradient.spread="100" ) summary(height=0 color="536870912" transparency="0" gradient.color="8421504" gradient.transparency="0" gradient.angle="0" brushmode="0" gradient.repetition.mode="0" gradient.repetition.count="0" gradient.repetition.length="100" gradient.focus="0" gradient.scale="100" gradient.spread="100" ) footer(height=0 color="536870912" transparency="0" gradient.color="8421504" gradient.transparency="0" gradient.angle="0" brushmode="0" gradient.repetition.mode="0" gradient.repetition.count="0" gradient.repetition.length="100" gradient.focus="0" gradient.scale="100" gradient.spread="100" ) detail(height=112 color="536870912" transparency="0" gradient.color="8421504" gradient.transparency="0" gradient.angle="0" brushmode="0" gradient.repetition.mode="0" gradient.repetition.count="0" gradient.repetition.length="100" gradient.focus="0" gradient.scale="100" gradient.spread="100" ) table(column=(type=date updatewhereclause=yes name=consultant_day_day_service dbname="consultant_day.day_service" ) column=(type=char(50) updatewhereclause=yes name=consultants_consultant_name dbname="consultants.consultant_name" ) column=(type=char(30) updatewhereclause=yes name=projects_project_name dbname="projects.project_name" ) column=(type=long updatewhereclause=yes name=projects_type_id dbname="projects.type_id" ) column=(type=char(30) updatewhereclause=yes name=projects_project_code dbname="projects.project_code" ) column=(type=char(3) updatewhereclause=yes name=consultant_day_day_visual dbname="consultant_day.day_visual" ) column=(type=decimal(0) updatewhereclause=yes name=consultants_consultant_id dbname="consultants.consultant_id" ) retrieve="PBSELECT( VERSION(400) TABLE(NAME=~"consultant_day~" ) TABLE(NAME=~"consultants~" ) TABLE(NAME=~"projects~" ) COLUMN(0 as ~"consultant_visible~") COLUMN(NAME=~"consultant_day.day_service~") COLUMN(NAME=~"consultants.consultant_name~") COLUMN(NAME=~"projects.project_name~") COLUMN(NAME=~"projects.type_id~") COLUMN(NAME=~"projects.project_code~") COLUMN(NAME=~"consultant_day.day_visual~") COLUMN(NAME=~"consultants.consultant_id~") JOIN (LEFT=~"consultants.consultant_id~" OP =~"=~"RIGHT=~"consultant_day.consultant_id~" ) JOIN (LEFT=~"consultant_day.project_code~" OP =~"=~"RIGHT=~"projects.project_code~" )) ORDER(NAME=~"consultant_day.day_service~" ASC=yes ) ORDER(NAME=~"consultant_day.consultant_id~" ASC=yes ) " ) column(band=detail id=1 alignment="0" tabsequence=32766 border="2" color="33554432" x="133" y="56" height="52" width="329" format="[general]" html.valueishtml="0" name=consultant_day_day_service visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Verdana" font.height="-7" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) column(band=detail id=3 alignment="2" tabsequence=32766 border="2" color="33554432" x="466" y="56" height="52" width="347" format="[general]" html.valueishtml="0" name=projects_project_name visible="1" edit.limit=30 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Verdana" font.height="-7" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) column(band=detail id=3 alignment="2" tabsequence=32766 border="2" color="33554432" x="818" y="56" height="52" width="347" format="[general]" html.valueishtml="0" name=projects_project_name_1 visible="1" edit.limit=30 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Verdana" font.height="-7" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) column(band=detail id=4 alignment="0" tabsequence=32766 border="2" color="33554432" x="457" y="0" height="48" width="393" format="[general]" html.valueishtml="0" name=projects_type_id visible="0" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no font.face="Verdana" font.height="-7" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) column(band=header id=5 alignment="0" tabsequence=32766 border="2" color="33554432" x="507" y="56" height="48" width="494" format="[general]" html.valueishtml="0" name=projects_project_code visible="0" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no font.face="Verdana" font.height="-7" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) column(band=detail id=6 alignment="0" tabsequence=32766 border="2" color="33554432" x="905" y="0" height="48" width="69" format="[general]" html.valueishtml="0" name=consultant_day_day_visual visible="0" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no font.face="Verdana" font.height="-7" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) column(band=detail id=7 alignment="0" tabsequence=32766 border="0" color="33554432" x="855" y="0" height="48" width="160" format="[general]" html.valueishtml="0" name=consultants_consultant_id visible="0" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no font.face="Verdana" font.height="-7" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) column(band=detail id=2 alignment="2" tabsequence=32766 border="2" color="33554432" x="466" y="0" height="52" width="699" format="[general]" html.valueishtml="0" name=consultants_consultant_name visible="1" edit.limit=50 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Verdana" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) htmltable(border="1" ) htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" pagingmethod=0 generatedddwframes="1" ) xhtmlgen() cssgen(sessionspecific="0" ) xmlgen(inline="0" ) xsltgen() jsgen() export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 ) import.xml() export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" ) export.xhtml()
Hors ligne
erasorz a écrit:
c'est une DW dynamique, je suppose qu'il n'y a pas de requête derrière
Oups! Pas vu le dynamique, mais il est possible d'en créer aussi avec un SyntaxFromSQL
Hors ligne
Au pire, si ta DW ne te sert que pour de l'affichage (pas d'update), tu peux utiliser une colonne existante de ta base.
A la fin de ton retrieve() tu initialise ta colonne avec ta valeur correspondant au visible.
Je sais, c'est pas très propre mais ça marche.
Hors ligne
nico a écrit:
Au pire, si ta DW ne te sert que pour de l'affichage (pas d'update), tu peux utiliser une colonne existante de ta base.
A la fin de ton retrieve() tu initialise ta colonne avec ta valeur correspondant au visible.
Je sais, c'est pas très propre mais ça marche.
Je vais devoir faire des update par la suite.
J'ai essayé de modifier ma DW, il me met qui ne connait pas la "column consultant_visible"
release 11.5; datawindow(units=0 timer_interval=0 color=1073741824 brushmode=0 transparency=0 gradient.angle=0 gradient.color=8421504 gradient.focus=0 gradient.repetition.count=0 gradient.repetition.length=100 gradient.repetition.mode=0 gradient.scale=100 gradient.spread=100 gradient.transparency=0 picture.blur=0 picture.clip.bottom=0 picture.clip.left=0 picture.clip.right=0 picture.clip.top=0 picture.mode=0 picture.scale.x=100 picture.scale.y=100 picture.transparency=0 processing=0 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes print.background=no print.preview.background=no print.preview.outline=yes hidegrayline=no showbackcoloronxp=no picture.file="" ) header(height=0 color="536870912" transparency="0" gradient.color="8421504" gradient.transparency="0" gradient.angle="0" brushmode="0" gradient.repetition.mode="0" gradient.repetition.count="0" gradient.repetition.length="100" gradient.focus="0" gradient.scale="100" gradient.spread="100" ) summary(height=0 color="536870912" transparency="0" gradient.color="8421504" gradient.transparency="0" gradient.angle="0" brushmode="0" gradient.repetition.mode="0" gradient.repetition.count="0" gradient.repetition.length="100" gradient.focus="0" gradient.scale="100" gradient.spread="100" ) footer(height=0 color="536870912" transparency="0" gradient.color="8421504" gradient.transparency="0" gradient.angle="0" brushmode="0" gradient.repetition.mode="0" gradient.repetition.count="0" gradient.repetition.length="100" gradient.focus="0" gradient.scale="100" gradient.spread="100" ) detail(height=112 color="536870912" transparency="0" gradient.color="8421504" gradient.transparency="0" gradient.angle="0" brushmode="0" gradient.repetition.mode="0" gradient.repetition.count="0" gradient.repetition.length="100" gradient.focus="0" gradient.scale="100" gradient.spread="100" ) table(column=(type=date updatewhereclause=yes name=consultant_day_day_service dbname="consultant_day.day_service" ) column=(type=char(50) updatewhereclause=yes name=consultants_consultant_name dbname="consultants.consultant_name" ) column=(type=long updatewhereclause=yes name=consultant_visible dbname="0" ) column=(type=char(30) updatewhereclause=yes name=projects_project_name dbname="projects.project_name" ) column=(type=long updatewhereclause=yes name=projects_type_id dbname="projects.type_id" ) column=(type=char(30) updatewhereclause=yes name=projects_project_code dbname="projects.project_code" ) column=(type=char(3) updatewhereclause=yes name=consultant_day_day_visual dbname="consultant_day.day_visual" ) column=(type=decimal(0) updatewhereclause=yes name=consultants_consultant_id dbname="consultants.consultant_id" ) retrieve="PBSELECT( VERSION(400) TABLE(NAME=~"consultant_day~" ) TABLE(NAME=~"consultants~" ) TABLE(NAME=~"projects~" ) COLUMN (NAME=~"consultant_visible~") COLUMN(NAME=~"consultant_day.day_service~") COLUMN(NAME=~"consultants.consultant_name~") COLUMN(NAME=~"projects.project_name~") COLUMN(NAME=~"projects.type_id~") COLUMN(NAME=~"projects.project_code~") COLUMN(NAME=~"consultant_day.day_visual~") COLUMN(NAME=~"consultants.consultant_id~") JOIN (LEFT=~"consultants.consultant_id~" OP =~"=~"RIGHT=~"consultant_day.consultant_id~" ) JOIN (LEFT=~"consultant_day.project_code~" OP =~"=~"RIGHT=~"projects.project_code~" )) ORDER(NAME=~"consultant_day.day_service~" ASC=yes ) ORDER(NAME=~"consultant_day.consultant_id~" ASC=yes ) " ) column(band=detail id=1 alignment="0" tabsequence=32766 border="2" color="33554432" x="133" y="56" height="52" width="329" format="[general]" html.valueishtml="0" name=consultant_day_day_service visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Verdana" font.height="-7" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) column(band=detail id=3 alignment="2" tabsequence=32766 border="2" color="33554432" x="466" y="56" height="52" width="347" format="[general]" html.valueishtml="0" name=projects_project_name visible="1" edit.limit=30 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Verdana" font.height="-7" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) column(band=detail id=3 alignment="2" tabsequence=32766 border="2" color="33554432" x="818" y="56" height="52" width="347" format="[general]" html.valueishtml="0" name=projects_project_name_1 visible="1" edit.limit=30 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Verdana" font.height="-7" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) column(band=detail id=4 alignment="0" tabsequence=32766 border="2" color="33554432" x="457" y="0" height="48" width="393" format="[general]" html.valueishtml="0" name=projects_type_id visible="0" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no font.face="Verdana" font.height="-7" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) column(band=header id=5 alignment="0" tabsequence=32766 border="2" color="33554432" x="507" y="56" height="48" width="494" format="[general]" html.valueishtml="0" name=projects_project_code visible="0" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no font.face="Verdana" font.height="-7" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) column(band=detail id=6 alignment="0" tabsequence=32766 border="2" color="33554432" x="905" y="0" height="48" width="69" format="[general]" html.valueishtml="0" name=consultant_day_day_visual visible="0" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no font.face="Verdana" font.height="-7" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) column(band=detail id=7 alignment="0" tabsequence=32766 border="0" color="33554432" x="855" y="0" height="48" width="160" format="[general]" html.valueishtml="0" name=consultants_consultant_id visible="0" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no font.face="Verdana" font.height="-7" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) column(band=detail id=2 alignment="2" tabsequence=32766 border="2" color="33554432" x="466" y="0" height="52" width="699" format="[general]" html.valueishtml="0" name=consultants_consultant_name visible="1" edit.limit=50 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Verdana" font.height="-8" font.weight="700" font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" background.transparency="0" background.gradient.color="8421504" background.gradient.transparency="0" background.gradient.angle="0" background.brushmode="0" background.gradient.repetition.mode="0" background.gradient.repetition.count="0" background.gradient.repetition.length="100" background.gradient.focus="0" background.gradient.scale="100" background.gradient.spread="100" tooltip.backcolor="134217752" tooltip.delay.initial="0" tooltip.delay.visible="32000" tooltip.enabled="0" tooltip.hasclosebutton="0" tooltip.icon="0" tooltip.isbubble="0" tooltip.maxwidth="0" tooltip.textcolor="134217751" tooltip.transparency="0" transparency="0" ) htmltable(border="1" ) htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" pagingmethod=0 generatedddwframes="1" ) xhtmlgen() cssgen(sessionspecific="0" ) xmlgen(inline="0" ) xsltgen() jsgen() export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 ) import.xml() export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" ) export.xhtml()
Hors ligne
Je pense que la colonne "consultant_visible" correspond à un exemple de nom pour ta colonne virtuelle.
erasorz a écrit:
Code: pb
dw_planning.SetItem( no_ligne, 'consultant_visible', 0 ) // ou dw_planning.SetItem( no_ligne, 'consultant_visible', 1 )
Hors ligne
? Et je ne dois rien créer dans ma DataWindow alors ?
Comment je fais pour créer et utiliser cette fameuse colonne virtuelle? Car la je mélange tous vos posts
Hors ligne
J'ai fait ceci mais j'ai un Invalid Data/row à la ligne du SetItem
dw_planning.modify('create column(name=consultant_visible visible="0")') //Display Planning consultant by consultant for ll_i_consult = 1 to ll_count_consult ll_consultant_id =lds_consultants.object.consultant_id[ll_i_consult] ls_filter = "consultants_consultant_id= " + string(ll_consultant_id) dw_planning.setfilter(ls_filter) dw_planning.filter() dw_planning.retrieve( ) ll_count_row = dw_planning.rowcount( ) //Test for only one cell on one day for ll_i = 2 to ll_count_row if date(dw_planning.object.consultant_day_day_service[ll_i]) = date(dw_planning.object.consultant_day_day_service[ll_i - 1]) then if dw_planning.object.consultants_consultant_id[ll_i] = dw_planning.object.consultants_consultant_id[ll_i - 1] then dw_planning.SetItem( ll_i, 'consultant_visible', 0 ) //dw_planning.object.consultants_consultant_name.visible = 0 dw_planning.modify("consultant_name.visible=~tIf(consultant_visible=0,0,1)") else //dw_planning.object.consultants_consultant_name.visible = 1 end if else //dw_planning.object.consultants_consultant_name.visible = 1 end if next next
Dernière modification par johnpelu (25-11-2008 12:24:48)
Hors ligne
Si j'ai bien compris, tu veux cacher consultant_name si :
1/ consultant_day_day_service de la ligne = consultant_day_day_service de la ligne précédente
2/ consultants_consultant_id de la ligne = consultants_consultant_id de la ligne précédente
Si c'est ça, pas besoin de colonne virtuelle, tu met en design dans l'expression visible de consultant_name la chaine suivante:
if ( currentrow() = 1, 1, if( consultant_day_day_service[-1] = consultant_day_day_service and consultants_consultant_id[-1] = consultants_consultant_id, 0, 1 ) )
Autrement dit, si on est sur la 1ere ligne (me souviens plus si c'est currentRow() ou getRow()), alors visible.
Sinon, si consultant_day_day_service de la ligne = consultant_day_day_service de la ligne précédente ET QUE consultants_consultant_id de la ligne = consultants_consultant_id de la ligne précédente ALORS invisible
Et visible dans les autres cas.
A noter l'utilisation de l'indexation à -1, super utile dans le cas présent...
PS: j'attire ton attention sur le fait que le 2eme export de ta DW que tu met ici presente une legère erreur: tu défini 8 colonnes (en ayant ajouté ta colonne virtuelle), alors que plus bas, tu définit des colonnes d'encodages pour les data columns d'index 1, 3, 3(!), 4, 5, 6, 7 et 2... Comme le 1er export... Je sais pas si c'est normal ça...
Hors ligne
J'ai mis ceci mais j'ai une erreur de syntaxe
dw_planning.object.consultants_consultant_name.visible ="if ( currentrow() = 1, 1, if( consultant_day_day_service[-1] = consultant_day_day_service and consultants_consultant_id[-1] = consultants_consultant_id, 0, 1 ) )"
En ce qui concerne la DataWindow, c'est p-e du au fait que j'ai dupliqué un champ car je vais utiliser ce champ pour afficher une autre valeur, en fait l'idée est d'avoir par jour :
| CONS1 | CONS2 |
JOURNEE | AM | PM | AM | PM|
etc..
| DIDIER | PAUL |
O1/O1/2008|XXX|YYYY |BLA| TEST|
Hors ligne
johnpelu a écrit:
J'ai mis ceci mais j'ai une erreur de syntaxe
Code: pb
dw_planning.object.consultants_consultant_name.visible ="if ( currentrow() = 1, 1, if( consultant_day_day_service[-1] = consultant_day_day_service and consultants_consultant_id[-1] = consultants_consultant_id, 0, 1 ) )"
En ce qui concerne la DataWindow, c'est p-e du au fait que j'ai dupliqué un champ car je vais utiliser ce champ pour afficher une autre valeur, en fait l'idée est d'avoir par jour :
| CONS1 | CONS2 |
JOURNEE | AM | PM | AM | PM|
etc..
| DIDIER | PAUL |
O1/O1/2008|XXX|YYYY |BLA| TEST|
Ne t'acharne pas à modifier la propriété visible comme ça, c'est pas juste:
- avec la même syntaxe, tu dois mettre ".visible = 'valeurinitiale~texpression'". Les expression sont stockées après un caractère tabulation qui les sépare de a valeur initiale spécifiée en design.
- utilise plutot un modify(), tu auras des erreurs plus explicites
- dans ce cas ci, encode l'expression en mode design, pas besoin de se compliquer la vie.
Sinon, j'ai un peu réfléchi, et j'ai essayé de te faire un résumé plus clair de ce que je te proposais précédemment, au cas où, ca te donnera peut-être des idées... Attention toutefois, je n'ai plus PB ici, donc il y a peut être quelques erreur de syntaxe, je fais ca de tête, déso.
En parlant de créer dynamiquement une DW, moi je voyais plutot les etapes suivantes:
1/ Créer un DWControl hérité de datawindow pour gérer un planning.
2/ Dans une methode genre uof_retrieveColumnCount, rechercher sur combien de consultants le planning va porter.
3/ Dans une methode genre uof_generateDWObjectSyntaxe, générer une syntaxe de datawindow external (plus besoin de query), en sachant que le nombre de colonne est fourni par uof_retrieveColumnCount.
En imaginant que tu veux un rendu du style pour x lignes et y colonnes pour afficher ton planning (pour faire comme une crosstab):
| labelCol1 | labelCol2 | ... | labelColy
labelLigne[1] | valeur_1[1] | valeur_2[1] | ... | valeur_y[1]
...
labelLigne[x] | valeur_1[x] | valeur_2[x] | ... | valeur_y[x]
La dwsyntax aurait le look suivant:
string ls_syntax long ll_i, ll_colCount ls_syntax = "release 11.5;~r~ntable(column=(type=char(30) updatewhereclause=yes name=labelLigne dbname='' )" ll_colCount = uof_retrieveColumnCount for ll_i = 1 to ll_colCount ls_syntax += " column=(type=char(50) name=valeur_" + string(ll_i) + " dbname='' )~r~n" next ls_syntax += ")~r~n" // C'est le minimum nécessaire pour créer les colonnes chargées de contenir les données, le reste du blabla (bandes detail, footer, header, etc...) tu le rajoute en fonction de la présentation que tu veux, l'important ici c'est la directive "table(...)". // Tu peux ajouter aussi des colonnes pour contenir tes id, en vue de faire des updates plus tard... Par exemple, 1 colonne "colonne_y_sourceid" pour chaque colonne... j'explique le sourceId plus bas... // à ca, faut rajouter tes colonnes de présentation (tu en fait une en tu la duplique ll_colCount fois...), genre: // column(band=detail id=[l'id de colonne dans la section table générée plus haut] alignment="0" ... tout ce que tu veux... ) // tu n'oublies pas de créer une column(...) pour le label de ligne, pas besoin pour la colonneId cachée (elle sera d'autant plus cachée...) // et quand ls_syntax est au poil, tu le renvoie return ls_syntax
4/ Dans une methode genre uof_retrievePlanning, tu purrais:
- retriever dans une datastore, en utilisant ton SQL pour récupérer toutes les infos (dates, nom de consultant, type de projet,...)
- faire un this.create( uof_generateDWObjectSyntaxe() ) pour initialiser ton dataObject de ta DWControl
- tester avec un isvalid(this.object) que tout s'est bien passé... (facultatif, mais recommandé)
- parcourir ta dataStore ligne à ligne (ou en filtrant par date, projet ou que sais-je d'abord si tu dois d'abord aggréger un peu les données brutes), et progressivement remplir ta datawindowControle tunnée avec les valeurs précalculées (sans oublier le label de ligne)
- et là est la beauté du truc, c'est que pour pouvoir mapper ta couche présentation (DWControl) avec ta couche donnée (datastore), il suffit de mettre dans les colonnesID (voir plus haut) le rowId correspondant dans ta datastore... Ou si tu as du aggréger, tu fais de colonnesID une suite chainée de rowID... RowId hein, pas row, sinon au 1er sort tout est perdu.
Et avec ce dernier point, si tu veux ouvrir un detail en cliquant sur une colonne valeur_2[5] par exemple, tu vas voir le rowID dans colonneID_2[5], puis dans ta datastore à la ligne de meme rowID, et tu as toutes les info pour appeller une fenetre de detail par exemple.
5 (bonus)/ Pour maintenant perfectionner ton rendu, sur le même principe que les colonneID, tu peux ajouter pour chaque ll_colCount une colonne "colonne_y_visible", une "colonne_y_backcolor" avec la valeur de la propriété correspondante pour la colonne "valuer_y". Et dans le visible de cette colonne, tu met genre "colonne_y_visible" (en remplacant le y) et il ne restera qu'à faire un setitem sur colonne_y_visible à la ligne voulue pour cacher "valeur_y" uniqquement sur cette ligne.
Hors ligne
Merci, même si je suis totalement paumé, la je crains le pire
Hors ligne
johnpelu a écrit:
Merci, même si je suis totalement paumé, la je crains le pire
No stress man, on est là pour ça... Si je suis pas clair (et c'est très possible), suffit de me dire ce qui coince et je t'explique. Ou un autre modo, parce que je pense pas avoir inventé l'eau tiède sur ce coup là.
Hors ligne
Je ne comprends pas le point 1, le point 2 c'est ok , c'est un Rowcount de ma datastore Consultants, et le point 3 c'est créer ma DX Dynamiquement en fonction du nombre de consultants que j'ai c'est cela ? et ma Query je la mets ou alors ?
Cortex a écrit:
En parlant de créer dynamiquement une DW, moi je voyais plutot les etapes suivantes:
1/ Créer un DWControl hérité de datawindow pour gérer un planning.
2/ Dans une methode genre uof_retrieveColumnCount, rechercher sur combien de consultants le planning va porter.
3/ Dans une methode genre uof_generateDWObjectSyntaxe, générer une syntaxe de datawindow external (plus besoin de query), en sachant que le nombre de colonne est fourni par uof_retrieveColumnCount.
La dwsyntax aurait le look suivant:Code: pb
string ls_syntax long ll_i, ll_colCount ls_syntax = "release 11.5;~r~ntable(column=(type=char(30) updatewhereclause=yes name=labelLigne dbname='' )" ll_colCount = uof_retrieveColumnCount for ll_i = 1 to ll_colCount ls_syntax += " column=(type=char(50) name=valeur_" + string(ll_i) + " dbname='' )~r~n" next ls_syntax += ")~r~n" // C'est le minimum nécessaire pour créer les colonnes chargées de contenir les données, le reste du blabla (bandes detail, footer, header, etc...) tu le rajoute en fonction de la présentation que tu veux, l'important ici c'est la directive "table(...)". // Tu peux ajouter aussi des colonnes pour contenir tes id, en vue de faire des updates plus tard... Par exemple, 1 colonne "colonne_y_sourceid" pour chaque colonne... j'explique le sourceId plus bas... // à ca, faut rajouter tes colonnes de présentation (tu en fait une en tu la duplique ll_colCount fois...), genre: // column(band=detail id=[l'id de colonne dans la section table générée plus haut] alignment="0" ... tout ce que tu veux... ) // tu n'oublies pas de créer une column(...) pour le label de ligne, pas besoin pour la colonneId cachée (elle sera d'autant plus cachée...) // et quand ls_syntax est au poil, tu le renvoie return ls_syntax
4/ Dans une methode genre uof_retrievePlanning, tu purrais:
- retriever dans une datastore, en utilisant ton SQL pour récupérer toutes les infos (dates, nom de consultant, type de projet,...)
- faire un this.create( uof_generateDWObjectSyntaxe() ) pour initialiser ton dataObject de ta DWControl
- tester avec un isvalid(this.object) que tout s'est bien passé... (facultatif, mais recommandé)
- parcourir ta dataStore ligne à ligne (ou en filtrant par date, projet ou que sais-je d'abord si tu dois d'abord aggréger un peu les données brutes), et progressivement remplir ta datawindowControle tunnée avec les valeurs précalculées (sans oublier le label de ligne)
- et là est la beauté du truc, c'est que pour pouvoir mapper ta couche présentation (DWControl) avec ta couche donnée (datastore), il suffit de mettre dans les colonnesID (voir plus haut) le rowId correspondant dans ta datastore... Ou si tu as du aggréger, tu fais de colonnesID une suite chainée de rowID... RowId hein, pas row, sinon au 1er sort tout est perdu.
Et avec ce dernier point, si tu veux ouvrir un detail en cliquant sur une colonne valeur_2[5] par exemple, tu vas voir le rowID dans colonneID_2[5], puis dans ta datastore à la ligne de meme rowID, et tu as toutes les info pour appeller une fenetre de detail par exemple.
Pour ci-dessous, en fait pour chaque LabelCol je veux 2 valeurs associées, une pour AM une pour PM, ce sera faisable ?
cortex a écrit:
En imaginant que tu veux un rendu du style pour x lignes et y colonnes pour afficher ton planning (pour faire comme une crosstab):
| labelCol1 | labelCol2 | ... | labelColy
labelLigne[1] | valeur_1[1] | valeur_2[1] | ... | valeur_y[1]
...
labelLigne[x] | valeur_1[x] | valeur_2[x] | ... | valeur_y[x]
Hors ligne
Le point 1, c'est juste que je propose de mettre toute la logique de generation du planning dans une datawindow controle - le controle graphique à mettre sur une fenetre par exemple - et pour ca jme suis dit que tu pourrais en faire un special pour ça en créant un user control hérité de datawindow controle. C'est tout.
Ta query, tu la met dans le datastore, c'est lui qui va retriever les données nécessaires, comme ça ça evite de surcharger la présentation avec moultes colonnes à cacher, voir de devoir les grouper, ou que sais-je. Comme ça le DWObject reste simple et tu peux le customiser plus facilement, tandis que du coté de la datastore tu peux garder tes données brutes sans te prendre la tête sur la manière de les grouper en fonction de ta présentation.
Donc, tu aura une datawindow controle avec les methodes uof_retrieveColumnCount, uof_generateDWObjectSyntaxe et uof_retrieveColumnCount. Au chargement tu n'aura qu'a appeller la derniere des 3, laquelle instantiera une datastore qui elle recupère tes données brutes avec ton fameux query que tu utilisait precedemment directement en présentation.
Donc ni retrieve ni settransobject dans la datawindow controle, puisque celle-ci aura un dataobject qu'elle génère elle meme et qui est non lié à la DB puisque external (sans SQL).
Et pour le split de tes colonnes "valeur_y", ben oui c'est possible, au lieu de créer une colonne valeur_y par ll_colCount, tu en génère 2: 1 "valeur_am_y" et 1 "valeur_pm_y". Il faudra juste que en générant les en-tête de colonnes tu leur donne une largeur qui couvre la largeur des 2 valeurs courrespondantes. Mais comme tu es dans une datawindow object freeForm, pas de souci...
Donc, ma boucle for devient:
for ll_i = 1 to ll_colCount ls_syntax += " column=(type=char(50) name=valeur_am_" + string(ll_i) + " dbname='' )~r~n" ls_syntax += " column=(type=char(50) name=valeur_pm_" + string(ll_i) + " dbname='' )~r~n" next
Hors ligne