I do not know exactly what is product builder. Is it a third party software?
if you do the following:
 
[class]

public class AB
{
int x;
int y;

}

[New]

void new(int c = 0, int d = 0)
{

x = c;
y = d;

}

The above is good enough for the class. Then you can test the class in a job in axapta as follows:
 
 
static void TestJob(Args _args)
{
      AB Test1 = new AB(2, 2);
      AB Test2 = new AB();
      ;
     
}
 
You will not get an error for the above.
 
If product builder is a third party program and the following statement is a valid syntax:
 
call A.init(2, 2)
 
you have a little more work to do. When you extent/inherit the RunBase class in Axapta the child class has an init method that you can override. Your class does not do that so there should not be an init method to override but I do not think it's a good thing to do when you name the method init since it might become confusing and I am not sure what Axapta is doing with this method. If for some reason Axapta really uses this init method as an override you cannot create and instance of an object in its' own init method before firt executing the method super() since the object would not be initialize. And this seem to be the error you are now getting. If this is really the case just change the name of the method to something else like initAB and you must use the static modifier as follows:
 
static void initAB(int a, int b)
{
  AB YAB;
  ;
 
  YAB = new(a, b);
}
 
Then you can go ahead and make your call from product builder. I notice that your call from product builder does not hold a handle to the object for future use if you intend to return value(s) from the object with an accessor method. Provided that you get this to work I will help you with the rest.

Varden Morris

 

J. Wray & Nephew Ltd. - Group I.S.

234 Spanish Town Road

Kingston 11, Jamaica, W.I.

 

Phone:  (876) - 923 - 6141 Ext. 2400, 2412
Fax:      (876) - 923 - 5372

Cell:      (876) - 3833566
Email:   [EMAIL PROTECTED]

            [EMAIL PROTECTED]              


affekatz <[EMAIL PROTECTED]> wrote:

I tried to make the following changes:

[class]

public class AB
{
int x;
int y;

}

[New]

void new(int c = 0, int d = 0)
{

x = c;
y = d;

}

[Methode init]

public void init(int a, int b)
{

AB XAB;
AB YAB;

XAB = new AB(); // initializing with constuctor default values

YAB = new AB(a,b); // User input

}

I can't make the instance in product builder ill have to still do the
call A.init(2,2)

I get the error message as follows: ( i don't know if it helps ? )

Error executing code: AB object not initialized

stack trace:
\classes\AB\init
<Runtime compiled code>\PBASource14740
\Classes\XppCompiler\execue
\Classes\PBAExecute\Run - line 43
\Classes\PBAExecute\RunConfig - line 22
\Classes\PBAExecute\execute - line 9
\Classes\FormButtonControl\clicked





--- In [EMAIL PROTECTED], Varden Morris
<[EMAIL PROTECTED]> wrote:
> I think what you did was to create a handle to the object but you
did not create an instance of the object that the handle points to.

> Since the class name is xx the handle you created, which is A,
would require the following declaration statement:

> xx A;

> You then need to point the handle to an instance of the object as
follows:

> A = new xx();


> Or you could have done it all in one statement as follows:

> xx A = new xx();

> You may now use the handle to access the object by calling the
object's methods.

>
> Varden Morris
>

>
> J. Wray & Nephew Ltd. - Group I.S.
>
> 234 Spanish Town Road
>
> Kingston 11, Jamaica, W.I.
>

>
> Phone:  (876) - 923 - 6141 Ext. 2400, 2412
> Fax:      (876) - 923 - 5372
>
> Cell:      (876) - 3833566
> Email:   [EMAIL PROTECTED]
>             [EMAIL PROTECTED]  
>
> affekatz <[EMAIL PROTECTED]> wrote:
>
> I have now made a simpel class just to try and use the functionality
> in axapta but when i call it from product builder it just says
object
> xx is not initialized. The example is placed here under:
>
>
> [Class]
> public class xx
> {
> int x;
> int y;
>
> }
>
> [Method]
> public void Xmethod(int a, int b)
> {
> x=a; //Initializing here i suppose
> y=b;
>
> int c;
>
> c=x+y;
> }
>
> [method 2]
>
> int Omethod()
> {
> return c;
> }
>
> i assume that i can call the method in product builder as this ( i
> made a class variable named A):
>
> A.Xmethod(4,5);
>
> and by calling method 2 you would get the answer:
>
> Answer = A.Omethod();
>
> Can any one help ?
>
>
>
>
>
>
> Sharing the knowledge on Axapta.
>
>
> Yahoo! Groups SponsorADVERTISEMENT
>
>
> ---------------------------------
> Yahoo! Groups Links
>
>    To visit your group on the web, go to:
> http://groups.yahoo.com/group/Axapta-Knowledge-Village/
>  
>    To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
>  
>    Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>
>
>                  
> ---------------------------------
> Do you Yahoo!?
>  Check out the new Yahoo! Front Page. www.yahoo.com





Sharing the knowledge on Axapta.



Do you Yahoo!?
Check out the new Yahoo! Front Page. www.yahoo.com

Sharing the knowledge on Axapta.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to