Date Value not getting Stored

Hi Everyone,

I have created a Form in Ax2012 with some StringEdit and a DateEdit and source for these Fields is “MyTable”.

Now in the Modified Field() of each of these Fields in the form Data Source i am sending the selected values by the user to my class using “ValueStr()” & storing the values in variables.

Like: CustAccount custAcc;

TransDate date;

MyClass class;

custAcc = Customer.valueStr();

date =str2Date(ActiveDate.valueStr(),123);

class = new MyClass();

class.mymethod(custAcc,date);

Now my problem is that , when i am sending the values as a parameter to my class, then in my local machine the Date value is getting correct value what ever the user select at the form level, but if i am running this code to some other machine, then some time the Date value is getting stored and some time the Date value is not means showing 0 for only “Date”.

And this is happening only for the Date Filter, for others like for Customer as specified it is working fine & sending the correct value.

What should be the Solution for this problem,Even I have also tried other EDT’s for Date like" Date1980" etc, but the problem is same. Working fine on my system but not on others.

Thanks & Regards

Pranav Gupta

Why don’t use simply use dateValue() instead of converting the date to string and back to date?

Hey Martin,

Thanks its working now.[:)][Y]

Hi Martin,

I want to ask 1 more question, is there any thing related to Enum values, like i also want to store the Enum value,

I have tried EnumType() and EnumTypeValue(), but they are only taking 1 value out of my three values,

for that i am then using this as a solution:

icon_sub = str2enum(IcSb::None,IcSb.valueStr());

where Icon_sub is a enum which has three values, none, Icon, Sub.

but here also since i have declared None above so in my code condition, it is not considering “IcSb::None” as a enum value, and skipping this condition

if(Date && IcSb)

{

}

Thanks & Regards

Pranav Gupta

Use selection() for combo boxes and radio buttons. In general, I don’t recommend using valueStr() at all, unless you need an explicit conversion to string. Even when getting values from string edit controls, use text() instead of valueStr().

Thanks Martin For such a Useful Information.

Thanks & Regards

Pranav