Jump to content
We've recently updated our Privacy Statement, available here ×

iReport + write functions


DSJain

Recommended Posts

Hello again,

 

There are some functions written in MS Access design to perform some calculations. Similar functions I have to write in iReport templates. I have no idea like where these function should be written and what should be the syntax.

The code in one of the functions is as below.

 

=Sum(somme_rectif([1NBUDGET])) -> The function Call

 

***************************

Function is as below -->

**************************

 

Function somme_rectif(bud As Variant)

 

' Cette fonction calcule la somme des rectifications d'un budget passé

' en paramètre

 

Dim db As Database

Dim r As Recordset

Dim sql As String

Dim t

 

If IsNull(bud) Or IsEmpty(bud) Or bud = "" Then

somme_rectif = 0

Exit Function

End If

 

t = 0

Set db = CurrentDb()

sql = "SELECT DISTINCTROW cRECTIFBUD.cMNET, cRECTIFBUD.cNBUDGET"

sql = sql & " FROM cRECTIFBUD"

sql = sql & " WHERE ((cRECTIFBUD.cNBUDGET = '" & bud & "') Or (cRECTIFBUD.cNBUDGETDEST = '" & bud & "'));"

Set r = db.OpenRecordset(sql)

If r.RecordCount > 0 Then

r.MoveFirst

Do Until r.EOF

t = t + IIf(r![cNBUDGET] = bud, r![cMNET], -r![cMNET])

r.MoveNext

Loop

End If

r.Close

 

somme_rectif = t

 

End Function

**********************************

 

How to write this function in iReport template and where.

 

Appreciate any kind of help.

 

Thanks a lot !!!

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...