Le forum (ô combien francophone) des utilisateurs de Powerbuilder.
Bonjour,
J'essaye de faire un trie dans une dw.
Dans la dw, j'ai un chanp code et un champ libelle. Le champ libelle est une dropdowndw.
Quand je fais le script dw_1.SetSort("LookUpDisplay(libelle) A") mais le return renvoie -1.
Je n'arrive pas à comprendre pourquoi. Quelqu'un a-t-il une idée ?
Hors ligne
Bonjour, est-ce que tu ne confonds pas les colonnes de la dropdown (code/libellé) et la colonne qui "porte" cette dropdown ?
par exemple si tu as un champ "pays" qui à cette dropdown (qui contient code/libelle), alors tu devras faire :
dw_1.SetSort("LookUpDisplay(pays) A")
Hors ligne
sur le champ nommé "libelle" dans la dw, la valeur est le code et à l'affichage, c'est un libelle via une dropdowndw.
Je veux trier par libelle
Hors ligne
tu peux mettre le code source de ta DW ?
Hors ligne
release 11.5; datawindow(units=0 timer_interval=0 color=67108864 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=64 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=88 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=char(12) updatewhereclause=yes key=yes name=surv_codeval dbname="Surveil_Val.Surv_CodeVal" dbalias=".Surv_CodeVal" ) column=(type=long updatewhereclause=yes key=yes name=surv_list dbname="Surveil_Val.Surv_List" dbalias=".Surv_List" ) column=(type=datetime updatewhereclause=yes key=yes name=surv_dtecrea dbname="Surveil_Val.Surv_DteCrea" dbalias=".Surv_DteCrea" ) column=(type=datetime updatewhereclause=yes name=surv_dtesup dbname="Surveil_Val.Surv_DteSup" dbalias=".Surv_DteSup" ) retrieve="SELECT Surveil_Val.Surv_CodeVal, Surveil_Val.Surv_List, Surveil_Val.Surv_DteCrea, Surveil_Val.Surv_DteSup FROM Surveil_Val WHERE Surveil_Val.Surv_DteSup IS NULL AND Surveil_Val.Surv_List = :an_type_list ORDER BY Surveil_Val.Surv_CodeVal, Surveil_Val.Surv_List, Surveil_Val.Surv_DteCrea " update="Surveil_Val" updatewhere=0 updatekeyinplace=no arguments=(("an_type_list", number)) ) text(band=header alignment="2" text="Code" border="0" color="33554432" x="9" y="4" height="56" width="411" html.valueishtml="0" name=surv_codeval_t visible="1" font.face="Arial" 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" ) text(band=header alignment="2" text="Libellé" border="0" color="33554432" x="439" y="4" height="56" width="1170" html.valueishtml="0" name=surv_codeval_1_t visible="1" font.face="Arial" 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" ) column(band=detail id=1 alignment="2" tabsequence=10 border="5" color="33554432" x="9" y="12" height="64" width="411" format="[general]" html.valueishtml="0" name=surv_codeval pointer="IBeam!" visible="1" edit.limit=12 edit.case=upper edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-8" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" 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="5" color="33554432" x="439" y="12" height="64" width="1170" format="[general]" html.valueishtml="0" name=surv_codeval_1 pointer="IBeam!" visible="1" dddw.name=d_dddw_lib_val_gen dddw.displaycolumn=libel dddw.datacolumn=codeval dddw.percentwidth=0 dddw.lines=0 dddw.limit=0 dddw.allowedit=no dddw.useasborder=no dddw.case=any dddw.autoretrieve=no font.face="Arial" font.height="-8" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" 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=30 border="0" color="33554432" x="1646" y="12" height="64" width="311" format="dd/mm/yyyy" html.valueishtml="0" name=surv_dtecrea pointer="IBeam!" visible="0" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes font.face="Arial" font.height="-8" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" 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="2" tabsequence=40 border="0" color="33554432" x="1961" y="12" height="64" width="306" format="dd/mm/yyyy" html.valueishtml="0" name=surv_dtesup pointer="IBeam!" visible="0" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.nilisnull=yes edit.autohscroll=yes font.face="Arial" font.height="-8" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16777215" 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="0" tabsequence=50 border="0" color="33554432" x="2272" y="12" height="64" width="219" format="[general]" html.valueishtml="0" name=surv_list visible="0" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no font.face="Arial" font.height="-8" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" 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" ) compute(band=detail alignment="0" expression="today()"border="0" color="33554432" x="2496" y="12" height="64" width="219" format="[general]" html.valueishtml="0" name=surv_dtearch visible="1" font.face="Arial" font.height="-8" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" 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
Et en faisant ça :
dw_1.SetSort("LookUpDisplay(surv_codeval_1) A")
?
Hors ligne
Ce ne foncitonne pas
setsort renvoie -1
Hors ligne
en fait ta colonne surv_codeval apparait dans 2 controles : un champ et un DDDW, c'est normal ?
Hors ligne
Oui. La colonne apparait deux fois, une fois pour afficher le code valeur en lui même, et une fois pour afficher le libellé du code valeur.
Hors ligne
j'arrive a mettre le sort sur "LookUpDisplay(surv_codeval_1) A" via un
modify("datawindow.table.sort='LookUpDisplay(surv_codeval_1) A'")
tu aurais le code de d_dddw_lib_val_gen pour faire le test complet ?
Hors ligne
Ca ne fonctionne pas . Le modify me retourne une valeur null.
Voila le code de "d_dddw_lib_val_gen" :
release 10; datawindow(units=0 timer_interval=0 color=16777215 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 hidegrayline=no ) summary(height=0 color="536870912" ) footer(height=0 color="536870912" ) detail(height=60 color="536870912" ) table(column=(type=char(12) updatewhereclause=yes name=codeval dbname="DefValGen.CodeVal" ) column=(type=char(25) updatewhereclause=yes name=libel dbname="DefValGen.Libel" ) retrieve="PBSELECT( VERSION(400) TABLE(NAME=~"DefValGen~" ) COLUMN(NAME=~"DefValGen.CodeVal~") COLUMN(NAME=~"DefValGen.Libel~")) " ) column(band=detail id=1 alignment="0" tabsequence=0 border="0" color="33554432" x="0" y="0" height="56" width="279" html.valueishtml="0" name=codeval visible="0" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no font.face="Arial" font.height="-8" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" ) column(band=detail id=2 alignment="0" tabsequence=0 border="0" color="33554432" x="0" y="0" height="60" width="859" html.valueishtml="0" name=libel visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=no font.face="Arial" font.height="-8" font.weight="400" font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="1073741824" ) htmltable(border="1" ) htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" ) 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
bdf94 a écrit:
Ca ne fonctionne pas . Le modify me retourne une valeur null.
"Null" ça m'étonnerait.
Modify retourne "null" si on lui passe un argument nul.
Autrement le résultat est soit une chaîne vide (si tout s'est bien passé) ou le texte de l'erreur si il y a un problème avec la syntaxe.
Il est aussi possible que le debugger te mente. Il est parfois assez farceur (ou instable, ça dépend comment on voit la chose)
Dernière modification par seki (19-04-2012 13:03:37)
Hors ligne
C'est une solution un peu radicale mais tu peux tenter de refaire complètement ta DW. On a déjà eu des comportements incompréhensibles avec des DW (contenant des DropDownDW) sur lesquelles on avait pas mal modifié la présentation...
Hors ligne
ah... je crois que erasorz a raison :
erasorz a écrit:
en fait ta colonne surv_codeval apparait dans 2 controles : un champ et un DDDW, c'est normal ?
Le setSort "fonctionne" mais n'a pas le comportement attendu: lookupdisplay(surv_codeval_1) semble prendre lookupdisplay(surv_codeval) à la place.
Hors ligne