Accessing Multivalue fields in the T24 --ROUTINE

  • emushaija
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 7 months ago - 13 years 7 months ago #7047 by emushaija
I am trying to test multivalue field for specific condition (value greater than 0) and add a counter for a particular record. T

Below is pseudo code of what i want to achieve
READ LMM.ACCOUNT.BALANCE
COUNT records in LMM.ACCOUNT.BALANCE = N
FOR i=0 to N
(
COUNT number of occurances multivalue field TRANS.PRIN.AMT in the record i= Z

WHILE Z DO
{IF TRANS.PRINT.AMT(Z) > 0
THEN COUNTER ++
}
Z--
)

Then after executing above pseudo code i want to display the results in below format

LD.NUMBER COUNTER

I am new to T24 programming and will appreciate your help to get the equivalent infobasic code for above pseudocode
Last edit: 13 years 7 months ago by emushaija.

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

More
13 years 7 months ago - 13 years 7 months ago #7048 by jpb
Hello emushaija,

in jBasic (infobasic) there are many way to achive your goal, one pissibility is :
PROGRAM COUNT.LD
    $INSERT I_COMMON
    $INSERT I_EQUATE
    $INSERT I_F.LMM.ACCOUNT.BALANCES
***
    FN.LAB = "F.LMM.ACCOUNT.BALANCES"
    F.LAB  = ""
    CALL OPF(FN.LAB,F.LAB)
***
    SEL.STMT = "SELECT ":FN.LAB
    ID.LIST = '' ; NO.RECS = 0
    CALL EB.READLIST(SEL.STMT, ID.LIST, '', NO.RECS, '')
***
    IF ID.LIST THEN
        LOOP
            REMOVE LAB.ID FROM ID.LIST SETTING MORE
        WHILE LAB.ID : MORE DO
            CNT = 0
            READ R.LAB FROM F.LAB,LAB.ID ELSE CONTINUE
            Z = DCOUNT(R.LAB<LD27.TRANS.PRIN.AMT>,VM)
            FOR I = 1 TO Z
                IF R.LAB<LD27.TRANS.PRIN.AMT,I> GT 0 THEN
                    CNT += 1
                END
            NEXT I
            CRT LAB.ID:"   ":CNT "3R"
        REPEAT
    END

    STOP
***
END

As this is a progam (to be started a jBase-prompt), you have to make shure you logged into T24 (in the correct company) before launching it. Else the routine has to be enlarged to get company details or to be a subroutine (started within T24), but that a bit more of coding.
Last edit: 13 years 7 months ago by jpb.
The following user(s) said Thank You: emushaija

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

  • emushaija
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 7 months ago #7050 by emushaija
Thanks a lot jpb .It is a great help.

I have executed the program and it runs very much okey.

Now i am trying to understand the code!!

(i).What is the purpose of the following line

READ R.LAB FROM F.LAB,LAB.ID ELSE CONTINUE?

(ii). I have tried to modify the program to routine and run it in T24 works fine. In case i want to pass the results as array in the routine so i can invoke the results in other enquiries what would be the modification in the code?

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

More
13 years 7 months ago #7052 by jpb
READ --> www.jbase.com/r5/knowledgebase/manuals/3...es/man/jbc2_READ.htm

I think you're talking about a NOFILE enquiry again, instead of CRT LAB.ID... add it to OUT.ARR as in the old example : OUT.ARR<-1> = LAB.ID:"*":CNT

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

  • emushaija
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 7 months ago #7057 by emushaija
Thanks a lot .Now i have understood the whole code except one piece

LD27.TRANS.PRIN.AMT --where is the reference LD27 obtained? i thought it is a field number but in the the system (Through enquiry ) it is shown as number 4.

Thanks again

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

More
13 years 7 months ago #7058 by jpb
Have a look in I_F.LMM.ACCOUNT.BALANCES
should be located in GLOBUS.BP or T24_BP, hope you'll understand what I_F.-files are for

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

  • emushaija
  • Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
13 years 7 months ago #7059 by emushaija
ok thanks i really appreciate your help.Be blessed

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

Time to create page: 0.085 seconds