Le forum (ô combien francophone) des utilisateurs de Powerbuilder.




Bonjour,
P-e me suis-je mal exprimé lors de mon précédent post.
Lors d'un retrieve d'une crosstab datawindow, on récupère le nombre de lignes, sur ce point je suis parfaitement d'accord, mais comment récupère la valeur pour ma ligne "n" de ma colonne "x" ou "y"
Lorsque je fais un messagebox comme ceci :
messagebox("projectcode",string(dw_planning.object.projects_project_code[ll_i]))
Je n'obtiens les valeurs que pour ma première colonne, et je n'arrive pas à trouver comment faire pour récupérer pour les autres colonnes.
Message de modération:
Dernière modification par johnpelu (13-11-2008 15:59:46)
Hors ligne














dw_planning.Modify("DataWindow.Crosstab.StaticMode='Yes'") // ligne 1 - colonne 1 ls_value = dw_planning.GetItemString( 1, 1 ) // ligne 1 - colonne 2 ls_value = dw_planning.GetItemString( 1, 2 ) // etc // fin mode statique dw_planning.Modify("DataWindow.Crosstab.StaticMode='No'")
Hors ligne




J'ai un message d'erreur quand j'essai ce bout de code
---------------------------
PowerBuilder Application Execution Error (R0012)
---------------------------
Application terminated.
Error: DataWindow column type does not match GetItem type at line 16 in function of_display of object w_planning.
---------------------------
OK
---------------------------
Hors ligne











Regarde le type de ta colonne, et adapte en fonction de celui-ci:
String => GetItemString
Number => GetItemNumber
Date => GetItemDate
etc...
Si tu ne connais pas le type à l'avance, tu peux aussi utiliser la notation pointée
Hors ligne




Ma colonne est pourtant bien un String
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=4 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="" crosstab.dynamic = yes grid.lines=0 grid.columnmove=no selected.mouse=no ) header[1](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" ) header[2](height=60 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=192 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=84 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=datetime updatewhereclause=yes name=consultant_day_day_service dbname="consultant_day_day_service" ) column=(type=char(30) updatewhereclause=yes name=projects_project_code dbname="projects_project_code" ) retrieve="PBSELECT( VERSION(400) TABLE(NAME=~"consultant_day~" ) TABLE(NAME=~"consultants~" ) TABLE(NAME=~"projects~" ) COLUMN(NAME=~"consultant_day.consultant_id~") COLUMN(NAME=~"consultant_day.day_service~") COLUMN(NAME=~"consultants.consultant_name~") COLUMN(NAME=~"projects.project_code~") COLUMN(NAME=~"projects.project_name~") COLUMN(NAME=~"projects.type_id~") JOIN (LEFT=~"consultants.consultant_id~" OP =~"=~"RIGHT=~"consultant_day.consultant_id~" ) JOIN (LEFT=~"projects.project_code~" OP =~"=~"RIGHT=~"consultant_day.project_code~" )) " sort="consultant_day_day_service A " ) text(band=header[2] alignment="0" text="@consultants_consultant_name" border="0" color="33554432" x="731" y="4" height="128" width="617" html.valueishtml="0" name=projects_project_code_t visible="1" font.face="Tahoma" font.height="-10" 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=1 alignment="0" tabsequence=32766 border="0" color="33554432" x="9" y="4" height="76" width="713" format="[shortdate] [time]" html.valueishtml="0" name=consultant_day_day_service visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no edit.autohscroll=yes font.face="Tahoma" font.height="-10" 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="1" tabsequence=32766 border="0" color="33554432" x="731" y="4" height="76" width="617" format="[general]" html.valueishtml="0" name=projects_project_code visible="1" dddw.name=d_dddw_projectlist dddw.displaycolumn=project_name dddw.datacolumn=project_code dddw.percentwidth=0 dddw.lines=0 dddw.limit=0 dddw.allowedit=no dddw.useasborder=no dddw.case=any crosstab.repeat=yes font.face="Tahoma" font.height="-10" 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" ) crosstab(band = foreground crosstabonly = yes columns = "consultants_consultant_name" rows = "consultant_day_day_service" values = "projects_project_code" sourcenames = "consultant_day_consultant_id, consultant_day_day_service, consultants_consultant_name, projects_project_code, projects_project_name, projects_type_id")htmltable(border="0" cellpadding="1" cellspacing="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














arf, la colonne 1 est une datetime...
les données string commencent à la colonne 2...
Hors ligne




Effectivement, pour la première colonne ca fonctionne , par contre quand je veux faire un messagebox de la deuxième colonne il n'affiche rien, on dirait que le GetItemString pour la colonne 2 ne fonctionne meme pas , le ls_value est null
Dernière modification par johnpelu (13-11-2008 13:03:34)
Hors ligne














et en faisant ça :
ls_value = dw_planning.GetItemString( 1, 'projects_project_code' ) ls_value = dw_planning.GetItemString( 1, 'projects_project_code_1' )
Hors ligne




Ca fonctionne comme cela, mais admettons que maintenant j'ai plusieurs colonnes, comment dois-je nommer ma colonne ?
Hors ligne














nom_colonne, nom_colonne_1, nom_colonne_2,...
Hors ligne




Ok et comme c'est entre '' je peux donc constituer le nom de ma colonne dans une chaine de caractères je présume ?
Dernière modification par johnpelu (13-11-2008 13:28:23)
Hors ligne














oui il suffit de récupérer le nb de colonnes et de faire la boucle qui va bien
// nb de colonnes li_col = Long( dw_planning.Describe( 'datawindow.column.count' ) ) // col1 = date // ...
Hors ligne