Author Topic: New Input or Default  (Read 6653 times)

DonQuixote

  • Rock Star
  • *****
  • Posts: 205
  • To Dream the Impossible Dream...
New Input or Default
« on: July 29, 2010, 05:14:28 PM »
On a maintenance screen the current values appear for each field.  These are also the defaults if you just "hit return" through the field.  Is there any way to determine if the user just "hit return" through a field verses re-entering the same value again?

Believe it or not... I have a request to give an "error message" if they manually re-enter the same number.   :o

Tom Pellitieri

  • Rock Star
  • *****
  • Posts: 224
  • Tom Pellitieri - Toledo, Ohio
Re: New Input or Default
« Reply #1 on: July 30, 2010, 06:51:50 AM »
In the Process After slot for the field, you can check if the corresponding field in @ORIG.REC matches @VALUE.  If @ORIG.REC = "", nothing was on file to start.  If @ORIG.REC = @VALUE, you've hit Enter with the same value.

@ORIG.REC is loaded with the same information as @RECORD when the read occurs.  If they don't match when you escape, you get the "Save Changes" prompt.

--Tom

DonQuixote

  • Rock Star
  • *****
  • Posts: 205
  • To Dream the Impossible Dream...
Re: New Input or Default
« Reply #2 on: July 30, 2010, 09:57:21 AM »
Here is the paradox.  Whatever is in RECORD<xx> is the default so if I hit return or re-enter, either way VALUE is the same as RECORD<xx>.  I need to tell which was done (Return) or (re-enter same value).

precisonline

  • President
  • Administrator
  • Rock Star
  • *****
  • Posts: 1612
    • Precision Solutions
Re: New Input or Default
« Reply #3 on: July 30, 2010, 10:29:49 AM »
Definitely a conundrum. You could possibly check @OTHER(18) and if the value and the record are the same and @OTHER(18) = 0, then they pressed <cr>.  If @OTHER(18) is 4 or 22 then they pressed the down arrow or tab (respectively).

Would that help?

Oh, and also note the @ORIG.REC thing is fine if the value is in @RECORD.  If the value is in @WORK... well, that's another issue.

Maybe something like this:

LOCAL L.VAR
*
CASE (@LINE<1,1> = 0)
  L.VAR = KEY
CASE (@LINE<1,1> > 0)
  L.VAR = @RECORD<@LINE<1,1>>
CASE (@LINE<1,1> < 0)
  L.VAR = @WORK<ABS(@LINE<1,1>)>
END CASE
*
IF @VALUE = L.VAR THEN
  IF @OTHER(18) = 0 THEN
    ERROR 'DUDE!  seriously?'
  END
END

This doesn't handle the situation with Prelude where they store stuff in like <27,8> but it could easily be adapted for that kind of thing.
And of course, you might flavor the message to taste...  :D
« Last Edit: July 30, 2010, 10:33:46 AM by precisonline »
-Kevin
Accidents "happen"; success, however, is planned and executed.

Tom Pellitieri

  • Rock Star
  • *****
  • Posts: 224
  • Tom Pellitieri - Toledo, Ohio
Re: New Input or Default
« Reply #4 on: July 30, 2010, 12:16:33 PM »
Kevin's suggestion still doesn't fully address the issue, unfortunately.  If they enter a value and press down arrow, you can't tell if they entered the value that was there originally.  (Yes, I know... **most** people wouldn't do this... but I know some Excel users who set their "Enter" keys to move right, not down, so they press down-arrow after entry...)

I think you could achieve this by adding a "New Value" column on your input screen, instead of using traditional entry.

1) Make all of your RECORD fields NON-ENTRY fields.
2) Create WORK fields as input fields to match all of your RECORD fields and paint them next to your RECORD fields.
3) After each WORK field is entered, run a Process After to compare the value against that in RECORD.
   a) If the value is null, they passed by.
   b) If it MATCHES the value in RECORD, you can provide a duplicate value warning.
   c) Otherwise, you can copy the value to RECORD and refresh the screen.

The layout of the Purchasing Parameter Maintenance screen overrides is similar to this, although the overrides are stored in a different part of the record.

-Tom

DonQuixote

  • Rock Star
  • *****
  • Posts: 205
  • To Dream the Impossible Dream...
Re: New Input or Default
« Reply #5 on: August 03, 2010, 06:37:12 PM »
I appreciate all the ideas.  I love puzzles like this.
Sadly there is no indicator to distinguish between the default and a new input.
I told the user that the prompt could display a space after the default value.
I thought it was a creative solution but it will not be implemented.  My solution:
the default is the old value plus a space
process before    <50> = <50>:" "     
the validation process would only have to be modified to TRIM the value.
the entry became mandatory, which was also necessary for other reasons.
process after
LOCAL TERR.NO
TERR.NO = @ORIG.REC<50>:" "
IF @VALUE=TERR.NO THEN
  ** default
  @VALUE = @ORIG.REC<50>
  @RECORD<50> = @VALUE
END ELSE
  ** something was entered
  IF @VALUE = @ORIG.REC<50> THEN
    DISP 4,"The Same Territory was Entered"
  END
END


precisonline

  • President
  • Administrator
  • Rock Star
  • *****
  • Posts: 1612
    • Precision Solutions
Re: New Input or Default
« Reply #6 on: August 03, 2010, 07:00:54 PM »
How about this.  Call a process in your default that shuttles the current value into a work variable. Then in the validation, you have the value as it was and the value as it is.  Would that work?
-Kevin
Accidents "happen"; success, however, is planned and executed.