Répétez apres moi :J'aime PBAdonf. J'aime PBAdonf. J'aime PBAdonf.

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

Recherche rapide

Annonce

Certaines rubriques, dont des cours, sont uniquement visibles par les membres du forum ^^.
Dans la rubrique Liens & Références, vous avez accès à un sommaire de téléchargement, profitez-en !
Il existe maintenant un nouveau TOPIC "Votre CV en Ligne" accessible uniquement par demande.

#1 13-11-2008 11:53:15

johnpelu  
Membre Power Geek
Date d'inscription: 17-10-2008
Messages: 179
Pépites: 677
Banque: 0

[RESOLU] Comment trouver colonne dans Crosstab

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 :

Code: pb

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

 

#2 13-11-2008 12:27:59

erasorz  
Admin
Lieu: Babylone
Date d'inscription: 23-11-2006
Messages: 5122
Pépites: 97,200
Banque: 2,147,483,647

Re: [RESOLU] Comment trouver colonne dans Crosstab

Code: pb

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'")

N'envoyez jamais un humain faire le travail d'un programme.

Hors ligne

 

#3 13-11-2008 12:36:35

johnpelu  
Membre Power Geek
Date d'inscription: 17-10-2008
Messages: 179
Pépites: 677
Banque: 0

Re: [RESOLU] Comment trouver colonne dans Crosstab

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

 

#4 13-11-2008 12:39:14

foon  
N2iGeek + MangasGeek = foon
Award: bf
Lieu: Bonchamp-Lès-Laval
Date d'inscription: 28-02-2007
Messages: 2493
Pépites: 106
Banque: 9,223,372,036,854,775,808

Re: [RESOLU] Comment trouver colonne dans Crosstab

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


Seuls ceux qui ne font rien ne font jamais d'erreurs
http://www.nerdtests.com/images/badge/163124fb7fb459a3.gif

Hors ligne

 

#5 13-11-2008 12:47:17

johnpelu  
Membre Power Geek
Date d'inscription: 17-10-2008
Messages: 179
Pépites: 677
Banque: 0

Re: [RESOLU] Comment trouver colonne dans Crosstab

Ma colonne est pourtant bien un String

Code: pb

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

 

#6 13-11-2008 12:51:23

erasorz  
Admin
Lieu: Babylone
Date d'inscription: 23-11-2006
Messages: 5122
Pépites: 97,200
Banque: 2,147,483,647

Re: [RESOLU] Comment trouver colonne dans Crosstab

arf, la colonne 1 est une datetime...

les données string commencent à la colonne 2...


N'envoyez jamais un humain faire le travail d'un programme.

Hors ligne

 

#7 13-11-2008 13:01:44

johnpelu  
Membre Power Geek
Date d'inscription: 17-10-2008
Messages: 179
Pépites: 677
Banque: 0

Re: [RESOLU] Comment trouver colonne dans Crosstab

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

 

#8 13-11-2008 13:04:28

erasorz  
Admin
Lieu: Babylone
Date d'inscription: 23-11-2006
Messages: 5122
Pépites: 97,200
Banque: 2,147,483,647

Re: [RESOLU] Comment trouver colonne dans Crosstab

et en faisant ça :

Code: pb

ls_value = dw_planning.GetItemString( 1, 'projects_project_code' )

ls_value = dw_planning.GetItemString( 1, 'projects_project_code_1' )

N'envoyez jamais un humain faire le travail d'un programme.

Hors ligne

 

#9 13-11-2008 13:16:32

johnpelu  
Membre Power Geek
Date d'inscription: 17-10-2008
Messages: 179
Pépites: 677
Banque: 0

Re: [RESOLU] Comment trouver colonne dans Crosstab

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

Hors ligne

 

#10 13-11-2008 13:20:23

erasorz  
Admin
Lieu: Babylone
Date d'inscription: 23-11-2006
Messages: 5122
Pépites: 97,200
Banque: 2,147,483,647

Re: [RESOLU] Comment trouver colonne dans Crosstab

nom_colonne, nom_colonne_1, nom_colonne_2,...


N'envoyez jamais un humain faire le travail d'un programme.

Hors ligne

 

#11 13-11-2008 13:25:47

johnpelu  
Membre Power Geek
Date d'inscription: 17-10-2008
Messages: 179
Pépites: 677
Banque: 0

Re: [RESOLU] Comment trouver colonne dans Crosstab

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

 

#12 13-11-2008 13:31:54

erasorz  
Admin
Lieu: Babylone
Date d'inscription: 23-11-2006
Messages: 5122
Pépites: 97,200
Banque: 2,147,483,647

Re: [RESOLU] Comment trouver colonne dans Crosstab

oui il suffit de récupérer le nb de colonnes et de faire la boucle qui va bien

Code: pb

// nb de colonnes
li_col = Long( dw_planning.Describe( 'datawindow.column.count' ) ) 

// col1 = date
// ...

N'envoyez jamais un humain faire le travail d'un programme.

Hors ligne

 

Pied de page des forums

Propulsé par FluxBB 1.2.22