What you need to do is bind a field to the "value" property. Have this match the "choices value" that you want to set as the "set value".
Since you say there are no examples, I'll provide one here. Here's the DDS:
Code: Select all
A INDARA
A R REC
A 1 2HTML('QPUIREC0 ')
A 1 3HTML('{"screen":{"record format nam-
A e":"rec"},"items":[{"id":"Dropdown1-
A ","field type":"select box","value"-
A :{"fieldName":"value","dataLength":-
A "10","trimLeading":"false","trimTra-
A iling":"true","blankFill":"false","-
A rjZeroFill":"false","dataType":"cha-
A r","formatting":"Text","textTransfo-
A rm":"none","designValue":"[value]"}-
A ,"left":"58px","top":"33px","choice-
A s":{"fieldName":"choices","dataLeng-
A th":"100","trimLeading":"false","tr-
A imTrailing":"true","blankFill":"fal-
A se","rjZeroFill":"false","dataType"-
A :"char","formatting":"Text","textTr-
A ansform":"none"},"width":"173px","c-
A hoice values":{"fieldName":"values"-
A ,"dataLength":"100","trimLeading":"-
A false","trimTrailing":"true","blank-
A Fill":"false","rjZeroFill":"false",-
A "dataType":"char","formatting":"Tex-
A t","textTransform":"none"}},{"id":"-
A Button1","field type":"button","css-
A class":"button","value":"Ok","left-
A ":"26px","top":"104px","width":"100-
A px","cursor":"default","response":{-
A "fieldName":"btnOkay","customTrue":-
A "","customFalse":"","dataType":"ind-
A icator","formatting":"Indicator","i-
A ndFormat":"1 / 0"}},{"id":"Button2"-
A ,"field type":"button","css class":-
A "button","value":"Exit","left":"150-
A px","top":"104px","width":"100px","-
A cursor":"default","response":{"fiel-
A dName":"btnExit","customTrue":"","c-
A ustomFalse":"","dataType":"indicato-
A r","formatting":"Indicator","indFor-
A mat":"1 / 0"}}]}')
A BTNEXIT 1A H
A BTNOKAY 1A H
A CHOICES 100A H
A VALUE 10A H
A VALUES 100A H
Here's the RPG code:
Code: Select all
H DFTACTGRP(*NO)
FDROPVALD CF E WORKSTN EXTDESC('SKTEST/DROPVALD')
F EXTFILE(*EXTDESC)
F HANDLER('PROFOUNDUI(HANDLER)')
/free
choices = 'Red,Blue,Orange,Green,Yellow,Brown,White,Black';
values = 'R,BL,O,G,Y,BR,W,BK';
value = 'Y'; // start with yellow.
dou btnExit = *on;
exfmt rec;
enddo;
*inlr = *on;
When you run this, you'll see that "YELLOW" comes up as the default choice, because the VALUE field is set to Y. Even though "Red" is first in the list, Yellow is the value because of the Y in the "value" property.
- dropvald.png (2.82 KiB) Viewed 639 times