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 03 JUL 2001 12:35:35PM Sadhana Shavdia wrote:

I have 2 fields - Division Number and Division Name. Div Name is a calculated field. User enters Div Num and the formula gets the name. I want to switch where user enters div name and formula gets the Div #. How would this affect all existing records(5000)? Should I first switch Div name to F field, somehow populate all of them and then switch Div Num to S? Is there any easier way?

(using AREV 2.12)

TIA

Sadhana


At 05 JUL 2001 09:38AM Peter Kassinski wrote:

Is it a rhetorical question ?


At 05 JUL 2001 12:01PM Sadhana Shavdia wrote:

Being more on end user side than on programming side, wanted to be sure if it was right approach. Didn't wanted to mess up other files and not sure if it would cause any problems with index. Anyway, thanks for answering in unique way!!

Sadhana


At 05 JUL 2001 12:48PM [url=http://www.sprezzatura.com" onMouseOver=window.status=Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:

Well this sounds very strange. It would seem that Div Code is a primary key to a Div table and that Div Name is an attribute of that table. In this case it would make no sense to store the Div Name any where other than in the Div table as it would denormalise the database.

What are you trying to achieve?

The Sprezzatura Group

World Leaders in all things RevSoft


At 05 JUL 2001 02:36PM Sadhana Shavdia wrote:

Yes, div number is the key to the DIVISION table. Currently the user has to enter div number which XLATEs the division name. User wants to enter Div Name and let the window translate the number. There is F2 popup at the div number prompt but user insists on entering div name. All existing records(approx 5000) hold div number only. How can I accomodate user's request without messing up existing records and without giving up the ability to sort by division?

Thanks!

Sadhana


At 05 JUL 2001 03:04PM [url=http://www.sprezzatura.com" onMouseOver=window.status=Click here to visit our web site?';return(true)]The Sprezzatura Group[/url] wrote:

Easily done

On the Div number prompt have an edit pattern or post prompt that checks if the entry was numeric or alpha. If numeric validate on Div table, if alpha do a btree.extract on the div table as in the following example code taken from the utilities downloadable free from our site.

FUNCTION INDEX.LOOKUP(DATAFILE,SRC.FILE,SRC.DICT,VERIFIELD,VALIDATE.KEY,MESSAGES)

*

* Author AMcA

* Date February 1989

* Purpose To provide centralised check on index files for typed in

* answer. Assumes that Keys are numeric and that lookups are not

* Also assumes that value to look up is in @ANS

*

* NB - AREV common variable names are deliberately used as

* they will be used most from windows, but to make the routine

* generic they are LOCAL variables

*

* Calling syntax is simple. If this is to be used on the edit

* pattern of a key prompt where the most common lookup is on for

* example surname and surname is BTREEd. If the user enters a

* number we will assume a key, if not assume that they entered

* a name and look for it. The routine assumes that a popup will

* exist with the name of the datafile being looked up on.

*

* @ANS=INDEX.LOOKUP(DATAFILE,SRC.FILE,SRC.DICT,"SURNAME",0,1)

    DECLARE FUNCTION UNASSIGNED

    IF UNASSIGNED(MESSAGES) THEN MESSAGES=1

    CURRENT.INPUT=@ANS

    IF NUM(CURRENT.INPUT) THEN

        *

        * Assume that it was a key request, so if validate.key is set see

        * if we can read it

        *

        IF VALIDATE.KEY THEN

            READ DUMMY FROM SRC.FILE,CURRENT.INPUT THEN

               

@ANS=CURRENT.INPUT

               

STATUS()=0

            END ELSE

               

IF MESSAGES THEN CALL MSG("That is not a valid key|Please try again","","","")

               

@ANS="

               

STATUS()=3

            END

        END ELSE

            *

            * Assume that they are adding a new one or whatever and allow through

            *

            STATUS()=0

            @ANS=CURRENT.INPUT

        END

    END ELSE

        *

        * Assume index lookup request

        *

        LOOKUP=TRIM(CURRENT.INPUT)

        *

        * Make lookup automatically partial if not already any sub string

        * search things specified

        *

        LOOKUP.BAK=LOOKUP

        CONVERT "().%]<" TO "" IN LOOKUP.BAK

        IF LOOKUP.BAK=LOOKUP THEN

            SWAP " " WITH " " IN LOOKUP

            LOOKUP := ]"

        END

        XREF.PARAMS=VERIFIELD : @VM : LOOKUP : @FM

        CALL BTREE.EXTRACT(XREF.PARAMS,DATAFILE,SRC.DICT,HITS)

        IF HITS THEN

            IF INDEX(HITS,@VM,1) THEN

               

*

               

* Multiple hits so make into active select list and call popup

               

*

               

CONVERT @VM TO @FM IN HITS

               

CALL MAKE.LIST(0,HITS,SRC.FILE,SRC.DICT)

               

CALL CATALYST("P","POPUPS*" : DATAFILE)

               

IF @ANS THEN

                   

STATUS()=0

               

END ELSE

                   

STATUS()=3

                   

@ANS="

               

END

            END ELSE

               

@ANS=HITS

               

STATUS()=0

            END

        END ELSE

            IF MESSAGES THEN CALL MSG("No matches found|Please try again","","","")

            STATUS()=3

            @ANS="

        END

    END

RETURN @ANS

]

The Sprezzatura Group

World Leaders in all things RevSoft


At 06 JUL 2001 09:49AM Sadhana Shavdia wrote:

Exactly what I needed. Thanks a lot!

Sadhana

View this thread on the forum...

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