PB à toute heure et à tout moment. (à parcourir avec modération)

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 19-04-2012 09:37:26

bdf94  
Membre Power Geek
Date d'inscription: 04-10-2006
Messages: 180
Pépites: 2,231
Banque: 0

SetSort

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

 

#2 19-04-2012 09:46:19

xlat  
0xc0000005
Award: bf
Lieu: Tanger (طنج)
Date d'inscription: 04-12-2010
Messages: 720
Pépites: 11,343
Banque: 100,221,387,868,884,300
Site web

Re: SetSort

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 :

Code: pb

dw_1.SetSort("LookUpDisplay(pays) A")

https://lut.im/eJINqa9o/vAtyxD0h "Don't believe everything you read on the Internet"
    -- Abraham Lincoln

www.ngs.ma

Hors ligne

 

#3 19-04-2012 10:07:24

bdf94  
Membre Power Geek
Date d'inscription: 04-10-2006
Messages: 180
Pépites: 2,231
Banque: 0

Re: SetSort

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

 

#4 19-04-2012 10:18:03

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

Re: SetSort

tu peux mettre le code source de ta DW ?


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

Hors ligne

 

#5 19-04-2012 11:10:03

bdf94  
Membre Power Geek
Date d'inscription: 04-10-2006
Messages: 180
Pépites: 2,231
Banque: 0

Re: SetSort

Code: pb

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

 

#6 19-04-2012 11:12:29

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

Re: SetSort

Et en faisant ça :

Code: pb

dw_1.SetSort("LookUpDisplay(surv_codeval_1) A")

?


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

Hors ligne

 

#7 19-04-2012 11:25:13

bdf94  
Membre Power Geek
Date d'inscription: 04-10-2006
Messages: 180
Pépites: 2,231
Banque: 0

Re: SetSort

Ce ne foncitonne pas
setsort renvoie -1

Hors ligne

 

#8 19-04-2012 11:42:40

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

Re: SetSort

en fait ta colonne surv_codeval apparait dans 2 controles : un champ et un DDDW, c'est normal ?


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

Hors ligne

 

#9 19-04-2012 11:48:59

bdf94  
Membre Power Geek
Date d'inscription: 04-10-2006
Messages: 180
Pépites: 2,231
Banque: 0

Re: SetSort

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

 

#10 19-04-2012 12:48:41

xlat  
0xc0000005
Award: bf
Lieu: Tanger (طنج)
Date d'inscription: 04-12-2010
Messages: 720
Pépites: 11,343
Banque: 100,221,387,868,884,300
Site web

Re: SetSort

j'arrive a mettre le sort sur "LookUpDisplay(surv_codeval_1) A" via un

Code: pb

modify("datawindow.table.sort='LookUpDisplay(surv_codeval_1) A'")


tu aurais le code de d_dddw_lib_val_gen pour faire le test complet ?


https://lut.im/eJINqa9o/vAtyxD0h "Don't believe everything you read on the Internet"
    -- Abraham Lincoln

www.ngs.ma

Hors ligne

 

#11 19-04-2012 12:53:18

bdf94  
Membre Power Geek
Date d'inscription: 04-10-2006
Messages: 180
Pépites: 2,231
Banque: 0

Re: SetSort

Ca ne fonctionne pas . Le modify me retourne une valeur null.

Voila le code de "d_dddw_lib_val_gen" :

Code: pb

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

 

#12 19-04-2012 13:02:19

seki  
0x73656B69
Award: bf
Lieu: Laquenexy & Luxembourg
Date d'inscription: 20-11-2008
Messages: 1118
Pépites: 4,296,080,204
Banque: 9,223,372,036,854,776,000
Site web

Re: SetSort

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)


The best programs are the ones written when the programmer is supposed to be working on something else. - Melinda Varian

Mes réponses PB sur StackOverflow
http://stackoverflow.com/users/flair/317266.png

Hors ligne

 

#13 19-04-2012 13:20:35

Geo  
Membre completement Geek
Lieu: Binche
Date d'inscription: 15-12-2008
Messages: 119
Pépites: 378
Banque: 0

Re: SetSort

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...


Rien ne sert de courir, il faut partir à point .

Hors ligne

 

#14 19-04-2012 13:46:03

xlat  
0xc0000005
Award: bf
Lieu: Tanger (طنج)
Date d'inscription: 04-12-2010
Messages: 720
Pépites: 11,343
Banque: 100,221,387,868,884,300
Site web

Re: SetSort

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 ?

http://geni.embeddingperl.com/public/images/pbadonf_t30414.png

Le setSort "fonctionne" mais n'a pas le comportement attendu: lookupdisplay(surv_codeval_1) semble prendre lookupdisplay(surv_codeval) à la place.


https://lut.im/eJINqa9o/vAtyxD0h "Don't believe everything you read on the Internet"
    -- Abraham Lincoln

www.ngs.ma

Hors ligne

 

Pied de page des forums

Propulsé par FluxBB 1.2.22