Hi all, im newbie to navision and im facing some problems in this situation. What i need to do is to distribute a resource and check for the dates where the resource is already allocated. For example,i have the date ranges
Resource 1 10-02-09 to 20-02-09 20%
Resource 1 03-02-09 to 12-02-09 20%
Resource 1 15-02-09 to 22-02-09 20%
Resource 1 01-02-09 to 21-02-09 20%
Resource 1 11-02-09 to 12-02-09 20%
it should be 5 interceptions, and the SUM of the allocations cant exceed 100%, so i need to check for interceptions when the user modifies the allocation %.
](*,) ](*,) ](*,) , cant find a solution for this, so any help will be gadly aprecciated.
Greetings
0
Comments
Declare to variables of type Rec -> Date
Set one of the as temporary.
DateRec
tmpDateRec
then do:
tmpDateRec.DELETEALL;
DateRec.SETRANGE("Period Type",DateRec."Period Type"::Date);
DateRec.SETRANGE("Period Start",DateValue1,DateValue2);
IF DateRec.FIND('-') THEN REPEAT
tmpDateRec := DateRec;
tmpDateRec.INSERT;
UNTIL DateRec.NEXT = 0;
If a date is included more times your insert will cause an error.
If you want to hadle the error then you can do :
IF NOT tmpDate.INSERT THEN BEGIN
Handle error here.
END;
You could also do it with MARK and no temporary records.
It's about the way you want to approach it. There are many ways...
Hope this helps you.