× Discuss on Template programming, jBASE programming, Enquiries, No-File enquiry, Enquiry routines, Version, Version routines, Menus, Abbriviations, Creating local reference fields, Fast path enquiries, Creating charts and graphs, Generating Reports, Deal slips, Straight through processing, Multi Company and Multi Book setup, Tabbed screens, Composite Screens, T24 API, etc...

Example of NOFILE enquiry

  • Pradeep
  • Topic Author
  • Offline
  • New Member
  • New Member
More
17 years 7 months ago #395 by Pradeep
Example of NOFILE enquiry was created by Pradeep
Can someone please help me create a NOFILE enquiry to extract data from two different sources. A simple worked example, or step by step procedure would be greatly appreciated.

Please Log in or Create an account to join the conversation.

More
17 years 6 months ago #396 by malai
Replied by malai on topic Example of NOFILE enquiry
If the information that needs to be presented in an enquiry does not exist in a single file, then the enquiry can me made to take information from routines. To do this first let us understand the way in which enquiry subsystem works.

The enquiry subsystem first builds up a list of ids, then picks up each id and constructs a record and then displays the records. If the information that needs to be presented does not exist in a file then subroutines can be written to do the task. Basically 2 routines needs to be written ? one which will construct a list of ids and one which will accept the id and build the record based on the id.

If a field is specified in an enquiry the type and position of the field is retrieved from the standard selection record of the file mentioned in the field FILE.NAME.

Standard selection is an application that basically stores the dictionary for a file. You could have data fields and logical fields (i.e. the information is a calculated value for e.g. from a subroutine). However generally when you try to input a standard selection record it will validate if a FILE.CONTROL record exists for the file. The only exception to this is if the SS record id begins with ?NOFILE?. So for our above requirement we will need to create an SS record with ID starting with ?NOFILE?. In the record for the ID field make it a R type field and attach a routine that would build a dynamic array of Ids that need to be displayed in the enquiry.

I_ENQUIRY.COMMON, a common file that is used in enquiries ? defines a variable called O.DATA which contains the ID of the record that is currently going to be displayed. Another common variable called R.RECORD (a dynamic array) is used by the enquiry subsystem to display the record. So you need to write a routine that would use the id defined in O.DATA and populate R.RECORD.

Example NOFILE routine

NOFILE routine

SUBROUTINE CUSTOMER.BALANCE(CUSTOMER.ARRAY)

$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_ENQUIRY.COMMON
$INSERT I_F.ACCOUNT
$INSERT I_F.CUSTOMER.ACCOUNT

GOSUB INITIALISE
GOSUB OPEN.FILES
GOSUB SELECTION.FIELDS
GOSUB FORM.SELECT.STATEMENT
GOSUB CALCULATE.BALANCE

RETURN

***********
INITIALISE:
***********

CUSTOMER.ARRAY = ''
FN.ACCOUNT = 'F.ACCOUNT'; FV.ACCOUNT = ''; RE.ACCOUNT = ''
FN.CUSTOMER.ACCOUNT = 'F.CUSTOMER.ACCOUNT'; FV.CUSTOMER.ACCOUNT = ''; RE.CUSTOMER.ACCOUNT = ''

RETURN

***********
OPEN.FILES:
***********

CALL OPF(FN.ACCOUNT,FV.ACCOUNT);
CALL OPF(FN.CUSTOMER.ACCOUNT,FV.CUSTOMER.ACCOUNT)

RETURN

*****************
SELECTION.FIELDS:
*****************

SEL.FIELDS = ''
SEL.FIELDS<-1> = '@ID'
SEL.FIELDS<-1> = 'MNEMONIC'

RETURN

**********************
FORM.SELECT.STATEMENT:
**********************

SEL.CMD = 'SELECT FBNK.CUSTOMER '

SEL.FLD.CNT = DCOUNT(SEL.FIELDS,FM)
WITH.PLACED = @FALSE

FOR SEL.IDX = 1 TO SEL.FLD.CNT

SEL.FLD = SEL.FIELDS<SEL.IDX>

LOCATE SEL.FLD IN D.FIELDS<1> SETTING LOC.POS THEN
IF WITH.PLACED = @TRUE THEN SEL.CMD := ' AND '
IF WITH.PLACED = @FALSE THEN
SEL.CMD := 'WITH '
WITH.PLACED = @TRUE
END

OPER.POS = D.LOGICAL.OPERANDS<LOC.POS>
SELECT.OPERATOR = OPERAND.LIST<OPER.POS>
RANGE.VALUE = D.RANGE.AND.VALUE<LOC.POS>

BEGIN CASE
CASE SELECT.OPERATOR EQ 'LK'
SELECT.OPERATOR = 'LIKE'
CASE SELECT.OPERATOR EQ 'UL'
SELECT.OPERATOR = 'UNLIKE'
END CASE

SEL.CMD := SEL.FLD:' ':SELECT.OPERATOR:' '':RANGE.VALUE:'''

END
NEXT SEL.IDX

RETURN

******************
CALCULATE.BALANCE:
******************

CALL EB.READLIST(SEL.CMD,CUST.LIST,'',NO.OF.CUS,SEL.ERR)

FOR CUST.IDX = 1 TO NO.OF.CUS

CUST.ID = CUST.LIST<CUST.IDX>

CALL F.READ(FN.CUSTOMER.ACCOUNT,CUST.ID,RE.CUSTOMER.ACCOUNT,FV.CUSTOMER.ACCOUNT,READ.ERROR)
IF RE.CUSTOMER.ACCOUNT = '' THEN CONTINUE

ACC.COUNT = DCOUNT(RE.CUSTOMER.ACCOUNT,FM)

FOR ACC.IDX = 1 TO ACC.COUNT

ACC.ID = RE.CUSTOMER.ACCOUNT<ACC.IDX>
CALL F.READ(FN.ACCOUNT,ACC.ID,RE.ACCOUNT,FV.ACCOUNT,READ.ERROR)
IF RE.ACCOUNT = '' THEN CONTINUE
WORK.BALANCE = RE.ACCOUNT<AC.WORKING.BALANCE>
IF WORK.BALANCE = '' THEN WORK.BALANCE = '0'

*IF ACC.IDX NE 1 THEN CUST.ID = ''
CUSTOMER.ARRAY<-1> = CUST.ID:'*':ACC.ID:'*':WORK.BALANCE

NEXT ACC.IDX

NEXT CUST.IDX

RETURN

SS Setup

15. 1 USR.FIELD.NAME. ID
16. 1 USR.TYPE....... R
17. 1. 1 USR.FIELD.NO CUSTOMER.BALANCE
20. 1 USR.DISPLAY.FMT 30L
24. 1 USR.SINGLE.MULT S

15. 2 USR.FIELD.NAME. @ID
16. 2 USR.TYPE....... S
20. 2 USR.DISPLAY.FMT 30L
24. 2 USR.SINGLE.MULT S
25. 2 USR.LANG.FIELD.


15. 3 USR.FIELD.NAME. MNEMONIC
16. 3 USR.TYPE....... S
20. 3 USR.DISPLAY.FMT 30L
21. 3 USR.ALT.INDEX..
24. 3 USR.SINGLE.MULT S


ENQUIRY Setup

1 PAGE.SIZE ........ 4,19
2 FILE.NAME......... NOFILE.CUSBAL
3. 1 FIXED.SELECTION ID
5. 1 SELECTION.FLDS. @ID
5. 2 SELECTION.FLDS. MNEMONIC

10. 1. 1 HEADER...... @(20,1)CUSTOMER ACCOUNT BALANCE SHEET
10. 1. 2 HEADER...... @(1,2)CUSTOMER ID
10. 1. 3 HEADER...... @(25,2)ACCOUNT ID
10. 1. 4 HEADER...... @(50,2)WORK BALANCE

11. 1 FIELD.NAME..... CUSTOMER.ID
12. 1. 1 OPERATION... 0
13. 1 COLUMN......... 1
15. 1. 1 CONVERSION.. F *,1,1

11. 3 FIELD.NAME..... CUSTOMER.ACC
12. 3. 1 OPERATION... 0
13. 3 COLUMN......... 25
15. 3. 1 CONVERSION.. F *,2,1

11. 4 FIELD.NAME..... CUSTOMER.AMT
12. 4. 1 OPERATION... 0
13. 4 COLUMN......... 50
15. 4. 1 CONVERSION.. F *,3,1
_________________
M A L A I
The following user(s) said Thank You: Olaniyi

Please Log in or Create an account to join the conversation.

More
17 years 6 months ago #397 by shenbasp2002
Replied by shenbasp2002 on topic Example of NOFILE enquiry
Good work malai...

but i feel the example is bit complicated one...

Regards,
Shenba

Please Log in or Create an account to join the conversation.

More
17 years 6 months ago #398 by malai
Replied by malai on topic Example of NOFILE enquiry
Long Long ago, i worked this....

Just I copied and pasted here....
_________________
M A L A I

Please Log in or Create an account to join the conversation.

  • Pradeep
  • Topic Author
  • Offline
  • New Member
  • New Member
More
17 years 6 months ago #399 by Pradeep
Replied by Pradeep on topic NOFILE Enquiry
Malai,

I thank you for the time and trouble you took in preparing exactly the kind of example I was seeking.

Kind regards.

Pradeep

Please Log in or Create an account to join the conversation.

More
17 years 6 months ago #400 by worktigers
Replied by worktigers on topic Example of NOFILE enquiry
We are here to help others on GLOBUS.

Cheer up and help us on developing this forum by posting and answering.

Please Log in or Create an account to join the conversation.

More
12 years 3 weeks ago - 12 years 3 weeks ago #10821 by Teejay
Replied by Teejay on topic Re: Example of NOFILE enquiry
Thanks, this helped.
Last edit: 12 years 3 weeks ago by Teejay.

Please Log in or Create an account to join the conversation.

  • silvergem
  • silvergem's Avatar
  • Offline
  • Elite Member
  • Elite Member
  • TAFC|R12/R13, TAFJ|R20
More
4 years 7 months ago #22334 by silvergem
CONVERSION IS ATTACHED PER FIELD WHICH YOU CAN MANIPULATE THE INPUT AND OUTPUT THE DATA (E.g Sorting the multivalue numbers...)


BUILD.ROUTINE
Routine to be invoked prior to the selection phase when running the enquiry. This routine must have one passed argument which will contain the following:

ENQ<1> = NAME OF ENQUIRY
ENQ<2,1> = SELECTION FIELD NAMES (USER INPUT)
ENQ<3,1>= ASSOCIATED OPERANDS

(EQ,LK etc.. ENQ<4,1> = DATA LIST e.g: SUBROUTINE ONLINE.REVAL(ENQ)
These routines should can be used to manipulate the data prior to selection.
The following user(s) said Thank You: srivatsav4111

Please Log in or Create an account to join the conversation.

Time to create page: 0.117 seconds