Riebens Blog

Engaging Infinite Improbability Drive...

Passing DATE to a procedure

Posted by Benjamin Dell
Benjamin Dell
Benjamin Dell has not set their biography yet
User is currently offline
on Monday, 04 June 2012
in Development Chat

If you have a control on a window that comes from a date field in a file, it is presented as an ansi string. 

So if you pass it to a procedure that requires a date passed, it will generate an error.

What i normally do is the following:


Mydate is Date = DocumentDate

INHEAD.PeriodCode = GetPeriodFromDate(Mydate)

This allows the called procedure to use the date passed directly for instance.


PROCEDURE GetPeriodFromDate(lcDate is Date)

MyReturnVal is int = -1



WHILE NOT HOut(Finperiods)

    IF Finperiods.PeriodStart <= lcDate AND Finperiods.PeriodEnd >= lcDate THEN

           MyReturnVal = Finperiods.PeriodCode



    HReadNext(Finperiods, FinperiodsID)


RESULT MyReturnVal

Kind Regards


0 votes
Tags: Untagged
Benjamin Dell has not set their biography yet