cancel
Showing results for 
Search instead for 
Did you mean: 

Assistance Class and Constructor

ged_hurst
Participant
0 Kudos

Hi,

I've created an assistance class + a constructor for it. This constructor needs a parameter to initialize the Assistance Class.

However I'm unable to pass it on since the instantiation of WD_ASSIST is done by the framework.

How can I achieve this?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Why must you do this in the CONSTRUCTOR? Why not just create a normal method for performing whatever it is you want to do and call this method from the WDINIT of the component controller?

ged_hurst
Participant
0 Kudos

Well,

I was using the assistance class as a helper class and I wanted to make sure that it was initialized correctly.

However I think this is not possible so I've moved the initialization code in a separate method.

Interestingly enough, a constructor can be specified for an assistance class but I'm afraid that no parameters can be assigned to it.

Thanks anyway.

Regards

Former Member
0 Kudos

Hi,

I dont agree with what you say that no parameters can be assigned to a constructor of an Assistance class. You can always have parameters assigned to the constructor. Only thing which you have to keep in mind is that they should not be required parameter. There can be parameters to the constructor of the assistance class albeit OPTIONAL.

Or else what Thomas had suggested is the correct way.

Manish.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

What would be the point of optional parameters in the constructor fo the Assistance Class?  In almost all cases, the Assistance Class is instantiated by the WD Framework.  Therefore there is no option to fill these optional parameters.  So unless you are creating the component instance via code (which really only works for embedded component usages) and passing an Assistance Class into the startup of the Component; there is no way to use these optional parameters.  That's a pretty narrow case in my view.

Former Member
0 Kudos

Yes Thomas. I totally agree with you. ideally an assistance class is always instantiated by the WD framework. But I just talked about the technical possibility of having a constructor for an assistance class.

Apart from the embedded component usage one more possibility which comes to my mind is coverting a normal class ( being used elese where in normal report programs where constructor is necessary for instantiating parameters) into an assistance class. Although the class may be copied into a new class and then by deleting the constructor and creating a method for the purpose which constructor used to do.

I welcome your thoughts on this scenario.

Answers (0)