Razzak,

I am still struggling with this.  If you have time to have a quick look over my 
code and let me know if you can see what I am doing wrong, that would be much 
appreciated. (I have modified this slightly while I try to make this work so I 
can run it from the editor rather than from a form.)

CLEAR VAR vorder_no, vsupplier_tmp,vorder_notxt
SET VAR vorder_no INTEGER =111  [This is usually set outside the EEP]
SET VAR vsuppl_no=suppl_no IN orders WHERE order_no=.vorder_no AND sno=.vsno
SET VAR vsupplier_tmp=supplier IN suppliers WHERE suppl_no=.vsuppl_no
SET VAR vinitval=((LJS(.vsupplier_tmp,20) & RJS(CTXT(.vorder_no),10)))
SHOW VAR vINITVAL

CHOOSE vorder_notxt FROM #VALUES FOR +
((LJS(supplier,20) & RJS(CTXT(order_no),10))),order_no +
FROM orderx WHERE sno=.vsno ORDER BY supplier +
CHKBOX 1 TITLE 'Order Number & Supplier' +
CAPTION 'CHOOSE Order Number To Change' +
LINES 20 +
FORMATTED +
OPTION INITVAL &vinitval

Thank you. I would be grateful for any help.

Regards,
 
John Docherty


From: [email protected] [mailto:[email protected]] On Behalf Of A. Razzak Memon
Sent: Thursday, 11 June 2015 7:33 p.m.
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Choose Command - Setting INITVAL with computed 
variables

John,
Here's the definition and a few examples to understand the use of
INITPOS and INITVAL parameters for the CHOOSE command.
Once you understand the typical use, you should be able to adapt 
as you see fit.

INITPOS specifies the pre-selected initial position(s) for the items 
in the list. 

The first position in the list is assigned zero, and increments for 
the number of values in the list (0 = 1, 1 = 2, 3 = 4, etc).

INITVAL specifies the pre-selected initial value(s) for the items in 
the list. 

-- Example 01
IF (CVAL('DATABASE')) <> 'RRBYW18' OR (CVAL('DATABASE')) IS NULL THEN
   CONNECT RRBYW18 IDENTIFIED BY NONE
ENDIF
   SET VAR vTitle TEXT = 'Choose Table(s)'
   SET VAR vCaption TEXT = 'Using INITPOS Option in CHOOSE Command'
   SET VAR vChoose TEXT = NULL
   CLS
   CHOOSE vChoose FROM #TABLES CHKBOX 2 +
   TITLE .vTitle +
   CAPTION .vCaption +
   LINES 27 +
   OPTION INITPOS 2,5 +
   |WINDOW_BACK_COLOR WHITE +
   |TITLE_BACK_COLOR WHITE +
   |TITLE_FONT_NAME Tahoma +
   |TITLE_FONT_COLOR NAVY +
   |TITLE_FONT_SIZE 14 +
   |LIST_BACK_COLOR WHITE +
   |LIST_FONT_NAME Tahoma +
   |LIST_FONT_COLOR NAVY +
   |LIST_FONT_SIZE 12 +
   |BUTTONS_SHOW_Glyph ON +
   |BUTTONS_BACK_COLOR WHITE
IF vChoose = '[Esc]' THEN
   GOTO Done
ENDIF
   -- Do what you have to do here ...
LABEL Done
    CLEAR VARIABLES vTitle,vCaption,vChoose
    RETURN

-- Example 02
IF (CVAL('DATABASE')) <> 'RRBYW18' OR (CVAL('DATABASE')) IS NULL THEN
   CONNECT RRBYW18 IDENTIFIED BY NONE
ENDIF
   SET VAR vTitle TEXT = 'Choose Table(s)'
   SET VAR vCaption TEXT = 'Using INITVAL Option in CHOOSE Command'
   SET VAR vChoose TEXT = NULL
   CLS
   CHOOSE vChoose FROM #TABLES CHKBOX 3 +
   TITLE .vTitle +
   CAPTION .vCaption +
   LINES 27 +
   OPTION INITVAL Customer,InvoiceHeader,Titles +
   |WINDOW_BACK_COLOR WHITE +
   |TITLE_BACK_COLOR WHITE +
   |TITLE_FONT_NAME Tahoma +
   |TITLE_FONT_COLOR NAVY +
   |TITLE_FONT_SIZE 14 +
   |LIST_BACK_COLOR WHITE +
   |LIST_FONT_NAME Tahoma +
   |LIST_FONT_COLOR NAVY +
   |LIST_FONT_SIZE 12 +
   |BUTTONS_SHOW_Glyph ON +
   |BUTTONS_BACK_COLOR WHITE
IF vChoose = '[Esc]' THEN
   GOTO Done
ENDIF
   -- Do what you have to do here ...
LABEL Done
    CLEAR VARIABLES vTitle,vCaption,vChoose
    RETURN

Have fun!

Very Best R:egards,

Razzak.

www.rbase.com
www.rbaseX.com
www.facebook.com/rbase
-- 
32 years of continuous innovation!
17 Years of R:BASE Technologies, Inc. making R:BASE what it is today!
--

On Wed, Jun 10, 2015 at 11:52 PM, John Docherty <[email protected]> wrote:
I have a CHOOSE command which allows the user to select an order number based 
on a calculated value which displays the Supplier & the Order number combined 
as a left & right justified field. I have tried to set the INITVAL to choose 
the current order being edited, but I cannot make this work, the INITVAL option 
being ‘ignored’.  The INITVAL is calculated using the same formula as the 
fields in the CHOOSE command.
 
I also tried other ‘options’, including just using the order number, but I 
couldn’t get that to work either.  (Sample DB obviously works OK in my db 
though.) 
 
As I assume that I am missing something here, if anyone has a working CHOOSE 
command sample, with the INITVAL being a calculated value, that they are 
prepared to share I would appreciate your help. 
 
Thank you.
 
Regards,
 
John Docherty
 

--- RBASE-L
=======================3D=======================3
D=
TO POST A MESSAGE TO ALL MEMBERS:
Send a plain text email to [email protected]

(Don't use any of these words as your Subject:
INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
=======================3D=======================3
D=
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: INTRO
=======================3D=======================3
D=
TO UNSUBSCRIBE:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: UNSUBSCRIBE
=======================3D=======================3
D=
TO SEARCH ARCHIVES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: SEARCH-n
(where n is the number of days). In the message body,
place any
text to search for.
=======================3D=======================3
D=


Reply via email to