Field to accept 0's

Hi,

In the bank module ,for creating checks a dialog box opens.User can create a check and a give a number to it.One of user trying to give as 00003 but after creationg it shows as 3.

Then i noticed the table (BankChequeTable).ChequeNum has a datatype as string.Will it be possible to make it accept 0’s?

Hello Sindhu,

If the data type is of string then it takes the values as ‘00003’, there wont be any problem of considering the values with zeros.There might other reason why it is not taking.

Thanks for the response Naresh. But i have a method for the dialog box to open.

public Object dialog()

{

DialogRunbase dialog = super();

dialogFromNegInstNum = dialog.addFieldValue(typeid(BankChequeStartNum), fromNegInstNum, “@SYS4083”);

dialogFromNegInstNum.lookupButton(0);

dialogNumOfNegInst = dialog.addFieldValue(typeid(BankChequeQty), numOfNegInst, “@SYS14578”);

return dialog;

}

On the above method there is a field called BankChequeStartNum .This field is responsible for adding the string ‘000003’ but i kept a break point on the above line but i could see that it takes the value as 3 instead of ‘000003’.So the methods itself elminates the 0’s so it saves in the table without 0’s/

go to the class CustOutPaym_Cheque class and check the code in getFromDialog method.

here the chequenumber which you are entering is converting from String to int and returning the integer value.

firstChequeNum = str2int(startChequeNum);

in this process it is removing the pre-fixed 0’s. you have to modify that code as you like.

but be careful, that this functionality will effect so many areas in AX system.

thanks for the response.I checked with the class and was trying to modify without int.But it was throwing like operand not compatible error.

Hello Sindhu,

In the class → CustOutPaym_Cheque → getFromDialog method() the code is
firstChequeNum = str2int(startChequeNum);

the variable firstChequeNum is integer, when you remove the str2int(), then you trying to store the string value into the integer variable.That is reason it throwing the error operand not comatiable error.

So when you are removing the str2int() , the variable also should be string data type.

ya thats right.

Siince i dont have much knowledge on class,i dont know where to change the variable as a string datatype so that it accepts the same.