Stored Procedure or as an Internal Command used with a Run Select would 
make it global.


On Friday, December 18, 2020 at 8:09:08 PM UTC-5 rbytes wrote:

> All:
>
> Love the seminar idea. Short of that, code sharing might be a step up. So, 
> my humble offering, FWIW:
>
> Shop environment
> Many hands hitting same terminal
> Excellent production skills
> Highly variable math skills.
> Dimensions arrive in a variety of formats.
> So, make input easy for all. Type exactly what you see.
>
> Best viewed in Courier New font:
>
> Dimensional inputs entered as TEXT within a single *VARIABLE EDIT* 
> control:
>
> decimal : 18.6875
> fraction: 18-11/16
> fraction: 18 11/16
>
> DOUBLE output produced for all inputs: 18.6875
>
> --file: snip_accept_decimal_or_text_number.rmd
> --rbse: rbmetal
> --auth: bachitiea
> --crea: 2020-12-17
>
> CLS
> CLEAR VAR v%
>
> --initialize variables ------------------
>   SET VAR vdim_input TEXT = NULL
>   SET VAR vdim_input_keep TEXT = NULL
>   SET VAR vdim_seg_wholeNum DOUBLE = NULL
>   SET VAR vdim_delimiter TEXT = NULL
>   SET VAR vdim_seg_fraction TEXT = NULL
>   SET VAR vdim_seg_decimals DOUBLE = NULL
>   SET VAR vdim_output DOUBLE = NULL
>
> --test values ---------------------------
>   SET VAR vdim_input = 18.6875
>   --SET VAR vdim_input = '18-11/16'
>   --SET VAR vdim_input = '18 11/16'
>   SET VAR vdim_input_keep = .vdim_input
>   
> --convert -------------------------------
>   IF vdim_input CONTAINS '.' THEN
>      SET VAR vdim_input DOUBLE
>      SET VAR vdim_output = .vdim_Input
>   ELSE
>      IF (TRIM(vdim_input)) CONTAINS ' ' THEN
>         SET VAR vdim_delimiter = ' '
>      ELSE
>         SET VAR vdim_delimiter = '-'
>      ENDIF
>      
>      SET VAR vdim_seg_wholeNum = +
>              (FLOAT(NINT(SSUBCD(.vdim_input,1,.vdim_delimiter))))
>      SET VAR vdim_seg_fraction = +
>              (SSUBCD(.vdim_input,2,.vdim_delimiter))
>      SET VAR vdim_seg_decimals =  +
>              (FLOAT((NINT(SSUBCD(.vdim_seg_fraction,1,'/')))/ +
>                     (NINT(SSUBCD(.vdim_seg_fraction,2,'/')))))
>      SET VAR vdim_output =  +
>            (.vdim_seg_wholeNum + .vdim_seg_Decimals)
>   ENDIF
>
> --test output ---------------------------
>   CLS
>   WRITE 'kept input (txt) : ',.vdim_input_keep
>   WRITE 'seg:wholeNum     : ',.vdim_seg_wholeNum
>   WRITE 'dim delimiter    : ',.vdim_delimiter
>   WRITE 'seg:fraction     : ',.vdim_seg_fraction
>   WRITE 'seg:decimals     : ',.vdim_seg_decimals
>   WRITE 'dim output (dec) : ',.vdim_output
>   
> RETURN
>
> Granted, there are a few exception handling niceties to add, and this 
> could be "generified" to run as a Custom Form Action serving all such 
> controls on a form. But it's Friday night.
>
> Best, Bruce
>
> Bruce A. Chitiea
> SafeSectors, Inc.
> -----------------------------------
> 112 Harvard Ave #272
> Claremont CA 91711-4716
> -----------------------------------
> *[email protected]*
> *-----------------------------------*
> +011 (909) 238-9012 c
> +011 (909) 912-8678 f
>
>

-- 
For group guidelines, visit 
http://www.rbase.com/support/usersgroup_guidelines.php
--- 
You received this message because you are subscribed to the Google Groups 
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rbase-l/ce43c43e-34ee-4655-adf6-c169c18e6e72n%40googlegroups.com.

Reply via email to