Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 22 MAR 2004 11:29:04PM Bob Laqua wrote:

Running Arev 3.12

Im using a SetProgram (Cataloged) routine to do an output conversion.

Before the output conversion is returned is there a way to detect if the user is on the prompt that is calling the output conversion or somewhere else i.e. Read Record, Recalculate prompts etc..

If user is on the prompt calling output conversion then I will return

a different value then if on any other prompt

btw this is a multi-valued field

Thanks


At 23 MAR 2004 09:13AM Dave Harmacek wrote:

Are you using a User Defined Conversion?

Is the prompt an Associated Multi-Value (Grouping) or standalone.

You can use Window COMMON to determine which prompt and multivalue position, but I would never use it if you have a User Defined Conversion.

If this is in a Grouping, then you can use the Post-Prompt to change the data in the prompt.

Dave


At 23 MAR 2004 03:56PM Bob Laqua wrote:

Dave

]Are you using a User Defined Conversion?

Yes

]Is the prompt an Associated Multi-Value (Grouping) or standalone.

It is a Amv

Here an example of what I am trying to get to happen.

In a Prompts Advanced Details.. In the “Justification” field put L(###) like an area code

Test run the window. Enter 425 then

When on the prompt the data looks like “425” when on any other prompt it displays as (425)

This is what I want to do in a User Defined Conversion (UDC)

When on the prompt the data is displayed as entered but any other time it displays per the UDC.

I would add that the UDC would handle both types of display.

I guess I would have to pass the UDC the prompt name so I can test whether the user is on that prompt. But just not quite sure how to go about it.

Any help would be great.

Bob


At 24 MAR 2004 02:50PM Dave Harmacek wrote:

First piece of advice "Don't mix patterns and justification with UDF". That is, don't use 'In the “Justification” field put L(###) like an area code'. UDF were designed to be used for both Prompt "Validation" and "Output Format". They should be used in the Dictionary as well. If in the Dictionary, then they operate properly in LIST and SELECT which is why you cannot embed Window COMMON. Window COMMON doesn't exist to LIST or SELECT.

If you re-read the UDF section of the RBASIC documentation you will find that you place code in separate sections for "Validation" (which is ICONV) and "Output Format" (which is OCONV). If they mirror one another, then you will get what you want without even knowing what prompt you are in!

SUBROUTINE AREACODE_CONV( TYPE, INVALUE, BRANCH, RETVAL)

*DHARMACEK 3/24/04

RETVAL=INVALUE

STATUS()=0

BEGIN CASE

CASE TYPE EQ "ICONV"
  • a valid area code is exactly 3 numeric digits when any other
  • characters are removed
  TEMP=INVALUE; CONVERT "0123456789" TO "" IN TEMP
  CONVERT TEMP TO "" IN INVAL ;*thus removing all but numerics
  IF INVAL MATCHES "3N" ELSE
    STATUS()=1
  END
CASE TYPE EQ "OCONV"
  • assumes only valid entries are passed
  IF LEN(RETVAL) THEN RETVAL=(":INVAL:")"

END CASE

RETURN

Dave


At 24 MAR 2004 03:51PM Bob Laqua wrote:

The example I gave is just to explain the display features I am trying to achieve. Not that I am trying to do an area code user defined function. Nor that I was trying to use “patterns and justification” in my quest.

In the example if you watch what the display does as you move on and off that prompt was my point

In order to write a UDF that reacts like the example I must somehow know when the user is ON or OFF the prompt to know which value to assign RETVAL. I.e. the “data entered” or a “formatted output pattern”.

Any help is appreciated

Thanks

Bob


At 24 MAR 2004 05:58PM Bob Carten wrote:

How about using the Branch flag?

MYCONV,INWINDOW

then in your conv

is_special_case='

equ myprompt$ to 12

if branch=INWINDOW" then

 $insert include, window_common%
 if wc_Wi%=myprompt$ then is_special_case=1

end

if is_special_case then

 ....

end else

 ...

end


At 24 MAR 2004 06:42PM Bob Laqua wrote:

Bob Carten

We are thinking alike J but during the read record process wc_Wi%=myprompt$

It looks like the Read Record process increments wc_Wi% as it runs thru all the prompts.

So even though I’m not on the prompt it still setting wc_Wi% to that prompts value.

If that makes sense.

I hate to say it but about the only other thing I could do is to put a pre/post prompt that activate/deactivates @user so I can test @user to see if I’m sitting on that prompt, but what a pain OR

To make pre/post prompt that adds or removes the user defined conversion from the prompts attributes which is probably what I will do. Unless one these extremely bright programmers know of another method.

If its impossible to detect then that one thing.. Just program around it J

I must say I didn’t expect this one to be so difficult.

Thanks

Bob.Laqua@cpc-web.com


At 25 MAR 2004 12:10AM ps wing wrote:

I havnt read the previous postings in detail, but I think I have used @TUTOR=WINDOW" to determine if the routine was being called from a window or program.


At 25 MAR 2004 11:43AM Michael Slack wrote:

Hello Bob:

I think what you are looking for is in the "Window Commom Reference" manual.  Look at WC_W% and WC_SI%.  What I would suggest is look for the dictionary position number in the WC_W%.  If they match then you are in the prompt you want to modify.  Then modify it.  The one thing that you need to be aware of is if the dictionary position is on more than one prompt on the window.
We've had occasions where the prompt position number was hard coded into the code.  Then the screen would change and throw everything off.  So in those cases, we've developed a couple snippets of code to make that more felxable.  I'm including two groups of code that do basically the same sort of thing.  I hope you find them useful.
By the way, I tend to use equate values to represent dictionary postion numbers within the code for readability.

Michael Slack

* First section of code *

FOR I=1 TO WC_W_CNT%

IF (WC_W%(I)=WO_DATE_MTR1_RDG$) OR (WC_W%(I)=WO_DATE_MTR2_RDG$) THEN
  IF (WC_W%(I)=R') AND (@RECORD)]=') THEN
    MSG('"':NAME:'" IS A REQUIRED FIELD.',MSG_MAP_A,'','')
    WC_VALID%=FALSE$
  END
END

NEXT I

====================================================================

* Second section of code *

GET_PROMPT_POS:

POS='

FOR J=1 TO WC_W_CNT% UNTIL POS

IF DICT_NO=WC_PROMPTS% THEN
  POS=J
END

NEXT J

RETURN

* DICT_NO=WO_SAFETY_PROC$ GOSUB GET_PROMPT_POS IF POS THEN IF @RECORD=Y' THEN WC_W%(POS) =CHAR(27):'C1?' ;*PROMPT COLOR: WHITE ON DARK-BLUE WC_W%(POS)=O' ;*ENTRY TYPE: O=OPTIONAL END ELSE WC_W%(POS) =CHAR(27):'C31' ;*PROMPT COLOR: CYAN ON LIGHT-BLUE WC_W%(POS)=P' ;*ENTRY TYPE: P=PROTECTED END END *

PROMPTS =WO_STOCK_NO$:@FM:WO_STOCKROOM$:@FM:WO_UNIT_COST$:@FM:WO_QTY_REQ$

PROMPTS := @FM:WO_CRAFT_CODE$:@FM:WO_JOB_STEPS$:@FM:WO_EST_NO_WORKERS$

PROMPTS := @FM:WO_EST_NO_HRS$

FOR I=1 TO 8

DICT_NO=PROMPTS[i]
GOSUB GET_PROMPT_POS
IF POS THEN
  WC_W%(POS) =CHAR(27):'C1?'    ;*PROMPT COLOR: WHITE ON DARK-BLUE
  WC_W%(POS)=O'               ;*ENTRY TYPE: O=OPTIONAL
END

NEXT I

====================================================================


At 25 MAR 2004 05:01PM Bob Laqua wrote:

Michael

ok I'll check this one out.. its similar to what I’ve tried so far except for the “couple snippets” :)

btw what type of business you in.. If you don’t mind.. send an email to me

Bob

Bob.Laqua@cpc-web.com

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/9ccba3b30aa8b51985256e6000132459.txt
  • Last modified: 2023/12/28 07:40
  • by 127.0.0.1