Hi everybody,
How to make the cursor go to the next line after scanning barcode with X++?
I create a form with a field: ItemId
After user AX scan a barcode into Itemid field, the cursor will automatically go to the next line.
How can I do this?
Appreciate for your help!
Regards,
Phuong Tran.
Hi Phuong,
What you are trying to achieve and how you have implemented this?
Does the barcode get scanned in ItemId field? If this is the case, override ‘modified’ field. You can do whatever you want from this method.
Regards,
DaveT
July 5, 2010, 10:25am
3
Hi Phuong,
I do not know AX but when using a barcode scanner it is normally a setup option where the scanner returns a string only or a string with a carrage return after it. Look at the setup manual for the scanner you are using - there is normally a barcode printed in the manual, then once scanned will change the setting.
phonvi
July 5, 2010, 11:05am
4
hi Mohanbabu,
I know that I will override “modified” method of ItemId field.
But if I have a lot of tab page, the cursor will move to the next tab page.
Or if I have another field next to ItemId field, the cursor will move to this another field.
So could you please tell me how to make the cursor go to the next line?
Anyone has any other ideal?
Thanks in advance.
Regards,
Phuong Tran.
phonvi
July 5, 2010, 11:17am
5
I write code in modified method like:
public void modified()
{
super();
table_ds.write();
table_ds.reread();
table.ItemId = “”;
table.insert();
ItemId_FieldControl.setFocus();
}
Anyone help me, highly appriciate!
Hi Dave,
Barcode scanner really return cursor to the new line in notepad.
But in AX, it seems doesn’t work.
Thanks for your information.
Harish
July 5, 2010, 11:43am
6
Hi,
Have a look at findRecord method in FormDataSource. For ex -
;
Select InventTable
order by …
where …
if (InventTable.recid)
{
inventTable_ds.findRecord(InventTable);
inventTable_ds.next();
}
Have a look in Developers guide for more info.
Hi Phuong,
The example I posted earlier was just a pseudo code.
For complete example, please click here .
Also if you look in standard forms, you will see more example.
Regards,
Hi Harish,
My code like:
public void modified()
{
TableA table_new;
;
super();
table_ds.write();
table_ds.research();
table_new.ItemId = “”;
table_new.insert();
table_new.findrecord(table_new);
ItemId_FieldControl.setFocus();
}
But it seems doesn’t work, please tell me if I have to modify something in my codes? Or you have any suggestions?
Thank you very much.
phonvi
July 5, 2010, 3:06pm
10
Hi Harish,
Here is my code:
public void modified()
{
TestTable testTableNew;
super();
TestTable_ds.write();
testTableNew.clear();
testTableNew.FieldA = “”;
testTableNew.insert();
TestTable_ds.research();
TestTable_ds.findRecord(testTableNew);
}
It works when my form only have FieldA field.
But when My form have a lot of tab pages. After I scan the barcode, the cursor move to the field of the next tab page → It doesn’t work.
Do you have any suggestions?
Thanks.
Regards,
Phuong Tran.
Hi,
Are you performing any action to read the barcode - inside the form…
put the code there
TableDataSource_ds.next();
phonvi
July 6, 2010, 9:01am
12
Thanks you.But it seems doesn’t work.
Phuong
phonvi
July 6, 2010, 9:06am
13
Hi Harish,
Here is my code that can use successfully:
public void modified()
{
TestTable testTableNew;
super();
TestTable_ds.write();
testTableNew.clear();
testTableNew.FieldA = “”;
testTableNew.insert();
TestTable_ds.research();
TestTable_ds.findRecord(testTableNew);
FieldA_control.setFocus();
}
And in other field controls in the grid FieldA_control, override method gotfocus:
public void gotfocus()
{
super();
FieldA_control.setFocus();
}
Thanks Harish for your valuable advices & thanks everybody.
Phuong
Harish
July 6, 2010, 2:43pm
14
Hi Phuong,
Glad to be of assistance.
If you think a post helped you, please verify the solution. This will help others if they have same requirement.
Thanks,