Hi!:
I am having an issue with Ax 2009 and C#.
Passing simple string values is not a problem.
But, when I need to pass a data type List, Ax "don't see"
C# method.
For example:
The method in C# is the following:
using System.Xml.Serialization;
[XmlArray(IsNullable = true)]
[XmlArrayItem("formaPago")]
public FormaPago[] listaFormaPago
{
get
{
return listaFormaPagoField;
}
set
{
listaFormaPagoField = value;
}
}
In Ax, how I pass this data?.
totalesSubTotales.set_listaFormaPago();
the parameter between parenthesis show me in Ax:
void set _ListaFormaPago(FormaPago[] value)
Regards!
If your question has been answered, please don't forget to verify the answer. It's done by clicking Did this answer your question? > Yes on the reply (or replies) answering the question.
You are very right!
Thanks!
I see no (5) in your code. Do you mean (1)?
Sorry, the right syntax seems to be FormaPago[1]().
Hello:
Morph X put in redline when I add (5) to AXV5ElectronicInvoice.TfhkaPaWebService.FormaPago[]
in the initialization of array in declaration.
AXV5ElectronicInvoice.TfhkaPaWebService.FormaPago[] array = new AXV5ElectronicInvoice.TfhkaPaWebService.FormaPago[](1);
Syntax error show me.
I am in Ax 2009.
Regards
I disagree - AXV5ElectronicInvoice.TfhkaPaWebService.FormaPago[ isn't and array of strings. It's an array of AXV5ElectronicInvoice.TfhkaPaWebService.FormaPago.
Where exactly do you get the syntax error?
Do I understand correctly that this works:
AXV5ElectronicInvoice.TfhkaPaWebService.FormaPago[] array;
but this fails to compile?
AXV5ElectronicInvoice.TfhkaPaWebService.FormaPago[] array = AXV5ElectronicInvoice.TfhkaPaWebService.FormaPago[](1);
Hi Martin!:
Well, I use your solution.
I declare an array of type String like following:
AXV5ElectronicInvoice.TfhkaPaWebService.FormaPago[] array;
No problem, It accepts it.
When I use the method in C# it accepts the array declarated before.
totalesSubTotales.set_listaFormaPago(array);
Before that I made the set in the array:
array.SetValue(formaPago,0);
But, I have a question, the unique part that does not work
is this:
TheNamespace.FormaPago[] array = TheNamespace.FormaPago[](5);
AXV5ElectronicInvoice.TfhkaPaWebService.FormaPago[] array = AXV5ElectronicInvoice.TfhkaPaWebService.FormaPago[](1);
The Ax send me error "syntax error".
Regards
This adds formaPago object to the array as the first element (index 0):
array.SetValue(formaPago, 0);
Hi Martin!:
Thanks for your prompt answer.
Yes it is. You are right.
It is an array of objects for "FormaPago".
I am setting the class FormaPago in Ax no problem with this:
formaPago.set_formaPagoFact("01");
formaPago.set_valorCuotaPagada(strLRTrim(num2Str(abs(custInvoiceJour.InvoiceAmount),11,2,0,0)));
formaPago.set_descFormaPago("");
But, before to pass to totalesSubTotales.set_listaFormaPago()
Do I need to pass formaPago object to an Array?
How I do that in Ax 2009?.
Regards.
There is no list - it's an array of FormaPago objects. You should be able to create it in this way:
TheNamespace.FormaPago[] array = TheNamespace.FormaPago[](5);
This creates an empty array for five elements.
Abhilash Warrier
565
Martin Dráb
536
Most Valuable Professional
André Arnaud de Cal...
402
Super User 2025 Season 1