iterate through a .Net array

Posted by gdb390 on 08-Dec-2009 04:03

Hello,

I have the following issue :

I have a user defined control ctrlSchedule (with the UltraScheduler in it) in which I declared a public event :

     define public event evt_BeforeAppointmentsDeleted  delegate System.EventHandler.

In the before Appointments deleted trigger, I have the following code

@VisualDesigner.
    method private void ultraDayView_BeforeAppointmentsDeleted( input sender as System.Object, input e as Infragistics.Win.UltraWinSchedule.BeforeAppointmentsDeletedEventArgs ):
       
        define variable clsEventArgs as common.EnhancedEventArgs no-undo.
       
        clsEventArgs = new common.EnhancedEventArgs().
       
        clsEventArgs:sender = e:Appointments.
       
        evt_BeforeAppointmentsDeleted:Publish(this-object, clsEventArgs).
   
        delete object clsEventArgs.
       
        return.

    end method.

In my main program where I include the UDF control, I have the following :

@VisualDesigner.
    method private void ctrlUltraSchedule_evt_BeforeAppointmentsDeleted( input sender as System.Object, input e as System.EventArgs ):
       
    define variable arrAppointments as "Infragistics.Win.UltraWinSchedule.Appointment[]" no-undo.
    define variable i               as integer                                           no-undo.
       
        arrAppointments = cast(cast(e,common.EnhancedEventArgs):sender, "Infragistics.Win.UltraWinSchedule.Appointment[]").
       
        /* deleten van de temp-table */
        empty temp-table ttAppointmentsToDelete no-error.
       
        do i = 0 to arrAppointments:Length - 1:
         
         
         
        end.
       
        message arrAppointments:Length
    view-as alert-box.
       
        return.

    end method.

I want to fill my temp-table with the tags of each appointment.

How do I get the single appointment in the do iteration ?

I tried arrAppointments[i], but that did not work

is there a way to make the .net array into an ABL array ?

kind regards

Gerd

All Replies

Posted by Admin on 08-Dec-2009 06:30

Did you try to use it as an ABL array (my preference), please be careful as the ABL array starts at 1!

DEFINE VARIABLE arrAppointments AS Infragistics.Win.UltraWinSchedule.Appointment EXTENT NO-UNDO .

ASSIGN arrAppointments = e:Appointments.

Alternatively, use the GetValue() method of the .NET System.Array type and cast back to the Appointment:

DEFINE VARIABLE oAppintment AS Infragistics.Win.UltraWinSchedule.Appointment NO-UNDO .

DO i = 0 TO e:Appointments:Length - 1:

    oAppointment = CAST(e:Appointments:GetValue(i), Infragistics.Win.UltraWinSchedule.Appointment) .

/* .... */

END.

Posted by gdb390 on 08-Dec-2009 07:34

Hey Mike,

I used the ABL array and it's working now !

thanks ! I owe you a beer !

Gerd

This thread is closed