Error in refreshing the form. (Item tracking form).

ramyavenkat
Member Posts: 94
1.In the tracking specification table we have added a field named barcode scan. (this field is kept to fetch the barcode number from barcode scanner)
2.In the form tracking line for e.g. from sales order.
For a particular item in tracking line, a Barcode scan will scan an particular barcode number and fill the field which we have newly created (barcode scan field). This number will be combination of item category code, Item, Serial number, Lot number.
3.For the particular item, the serial number and lot number will be split and put in the serial number and lot number field of reservation entry, and lot more filed in order to insert in that field is taken care.
4.Inserting is happening in the reservation entry table. But in the form once when we come out of the item tracking form and get inside only, the serial number and lot number is visible in the field.
5.I have tried putting currform.update, currform.updatecontrols in the triggers.
Yet, its not updating the serial number and lot number as soon as we split the barcode number from the barcode scan field.
How do we update this form?
We have written code in tracking specification table in the newly created field barcode scan in On Validate trigger.
So, how do we rectify this problem???:-((
2.In the form tracking line for e.g. from sales order.
For a particular item in tracking line, a Barcode scan will scan an particular barcode number and fill the field which we have newly created (barcode scan field). This number will be combination of item category code, Item, Serial number, Lot number.
3.For the particular item, the serial number and lot number will be split and put in the serial number and lot number field of reservation entry, and lot more filed in order to insert in that field is taken care.
4.Inserting is happening in the reservation entry table. But in the form once when we come out of the item tracking form and get inside only, the serial number and lot number is visible in the field.
5.I have tried putting currform.update, currform.updatecontrols in the triggers.
Yet, its not updating the serial number and lot number as soon as we split the barcode number from the barcode scan field.
How do we update this form?
We have written code in tracking specification table in the newly created field barcode scan in On Validate trigger.
So, how do we rectify this problem???:-((
0
Comments
-
I tested your idea and put a new code field named test in the table, and in the OnValidate trigger of the table, I inserted the:
"Serial No." := COPYSTR(test,1,2); "Lot No." := COPYSTR(test,3,2);
I updated the form with that field and when I fill the test field and press enter, the form displays the proper values, that means that it works just fine, without adding anything else.
Why don't you show your code? aybe there is something wrong there.0 -
Thanks Arhontis,
For taking effort to help us.
After writing the code in table for splitting the string, how did you update the form.what function you used, can u tel me and where to use??
Anyway i will give my code for ur referance. check and tell me.
In tracking specification table i have added a field as Barcode scan and in onvalidate of that feild i have wrriten this code.varEntryno := 0; varItmtrackCode := ''; varItem := ''; varserailno := ''; varLotno := ''; //Calsoft IF recResEntry.FIND('+') THEN varEntryno := recResEntry."Entry No."; recResEntry.INIT; recResEntry."Entry No." := varEntryno + 1; recResEntry."Item No." := "Item No."; recResEntry."Location Code" := "Location Code"; // recResEntry."Barcode Scan" := "Barcode Scan"; IF ("Source Type" = 37) THEN BEGIN recResEntry.Quantity := 1; recResEntry."Qty. to Invoice (Base)" := 1; recResEntry."Qty. to Handle (Base)" := 1; recResEntry."Quantity (Base)" := 1; END; IF ("Source Type" = 39) OR ("Source Type" = 5741) THEN BEGIN recResEntry.Quantity := -1; recResEntry."Qty. to Invoice (Base)" := -1; recResEntry."Qty. to Handle (Base)" := -1; recResEntry."Quantity (Base)" := -1; recResEntry.Positive := FALSE; END; IF ("Source Type" = 83) THEN BEGIN IF ("Source ID" = 'RECLASS') OR ("Source ID" = 'CONSUMP') THEN BEGIN recResEntry.Quantity := -1; recResEntry."Qty. to Invoice (Base)" := -1; recResEntry."Qty. to Handle (Base)" := -1; recResEntry."Quantity (Base)" := -1; recResEntry.Positive := FALSE; END ELSE BEGIN recResEntry.Quantity := 1; recResEntry."Qty. to Invoice (Base)" := 1; recResEntry."Qty. to Handle (Base)" := 1; recResEntry."Quantity (Base)" := 1; END; END; IF ("Source Type" = 37) OR ("Source Type" = 39) OR ("Source Type" = 5741) THEN BEGIN recResEntry."Reservation Status" := recResEntry."Reservation Status" :: Surplus; recResEntry."Creation Date" := WORKDATE; recResEntry."Source ID" := "Source ID"; recResEntry."Source Type" := "Source Type"; recResEntry."Source Subtype" := "Source Subtype"; recResEntry."Created By" := USERID; recResEntry."Qty. per Unit of Measure" := "Qty. per Unit of Measure"; recResEntry."Source Ref. No." := "Source Ref. No."; END; IF ("Source Type" = 83) THEN BEGIN recResEntry."Reservation Status" := recResEntry."Reservation Status" :: Prospect; recResEntry."Creation Date" := WORKDATE; recResEntry."Source ID" := "Source ID"; recResEntry."Source Type" := "Source Type"; recResEntry."Source Subtype" := 0; IF "Source ID" = 'RECLASS' THEN BEGIN recResEntry."Source Subtype" := 4; END; IF "Source ID" = 'CONSUMP' THEN BEGIN recResEntry."Source Subtype" := 5; END; recResEntry."Created By" := USERID; recResEntry."Qty. per Unit of Measure" := "Qty. per Unit of Measure"; recResEntry."Source Ref. No." := "Source Ref. No."; recResEntry."Shipment Date" := WORKDATE; recResEntry."Source Batch Name" := "Source Batch Name"; END; recSalesLin.SETRANGE(recSalesLin."Document No.","Source ID"); IF recSalesLin.FIND('-') THEN BEGIN recResEntry."Shipment Date" := recSalesLin."Shipment Date"; END; varBarcodeNo := "Barcode Scan"; varItmtrackCode := COPYSTR(varBarcodeNo,1,2); varItem := COPYSTR(varBarcodeNo,3,4); varserailno := COPYSTR(varBarcodeNo,7,5); varLotno := COPYSTR(varBarcodeNo,12,7); CLEAR(recItmLedEntry); recItmLedEntry.SETRANGE(recItmLedEntry."Item No.",varItem); recItmLedEntry.SETRANGE(recItmLedEntry."Location Code","Location Code"); IF recItmLedEntry.FIND('-') THEN BEGIN REPEAT IF recItmLedEntry.Open = TRUE THEN BEGIN IF recItmLedEntry."Remaining Quantity" <> 0 THEN BEGIN IF (recItmLedEntry."Serial No." = varserailno) AND ( recItmLedEntry."Lot No." = varLotno) THEN BEGIN recResEntry."Serial No." := recItmLedEntry."Serial No."; recResEntry."Lot No." := recItmLedEntry."Lot No."; MESSAGE('%1 serial',recResEntry."Serial No."); MESSAGE('%1 lot',recResEntry."Lot No."); END; END; END; UNTIL recItmLedEntry.NEXT= 0; END; recResEntry.INSERT(TRUE); MESSAGE('%1',recResEntry."Entry No.");
This code is written for all the areas where i have to apply barcode scanning in tracking form like Item journal,Item reclassification,Consumption journal,Warehouse receipts and few more areas.
The logic behind this code is.I will get the barcode number in a feild tracking specification form and i will spilt the serail no,lotno,item,item category code,and insert the serail no,lot no alone in reseravtion table along with few other feild that is needed to insert in that reservation table compulsaryly.
The serail no and lot no before inserting ,i am checking it with item ledger entry for validation whether serail no,lot no inbound only has oubounded.
In warehouse receipt form, item tracking form where should i put function for updating the form or should i need to put in table.Tell me???0 -
Hi ramyavenkat,
In the OnValidate routine of the new field in the table I placed the copystr code and I just placed the new field on the Tracking form.
Nothing else...
In your code, you never use VALIDATE function why? I think you should, it's a good way to know that your data is OK.
At the start, when initializing the recResEntry, you should use LOCKTABLE cause the Entry no might be used by some other user... See an example at Codeunit 12, function InitCodeUnit.
You have nowhere the assignment of:"Serial No." := varserailno; "Lot No." := varLotno;
How come and the values are saved in the table?
If you don't assign the values to the Lot No. and the Serial No you these will not be updated into the form!
In addition consider using CASE statement instead of the multiple IF and group the case so that you use less code.0 -
Thanks Arhontis for your valuable suggestions for the efficiancy of code. I will make the needful changes like case statement and locktable functions.
I have Assigned the serial no and lot number in reservation entry.Before assigning, few conditions are checked for serial number, lot number in item ledger entry.These conditions are checked in order to have serial number & lot number both same in inbound and outbound.recResEntry."Serial No." := recItmLedEntry."Serial No."; recResEntry."Lot No." := recItmLedEntry."Lot No.";
I have assigned all other defualt feild of reseravtion entry also in order to get inserted in to the table.From reseravtion entry table only, the tracking specification table values are got.0 -
-
Hi there,
Why don't you use Amount, Serial No. and Lot No. also as filter then it will search faster? (try to use SETFILTER)
You were looping the rec RecItmLedEntry for overall records, but you didn't quit the loop after you found IF (recItmLedEntry."Serial No." = varserailno) AND ( recItmLedEntry."Lot No." = varLotno)Then if there're more than one record found, you only got the last one, didn't you?
and this last would be inserted to recResEntry.
that's all about it.0 -
Great idea Jemmy,
Filtering would make the code very faster, I can't understand why I didn't see it!0 -
Thanks Arhontis & Jemmy.0
-
I have also added a new field in Tracking Specification Table...called A. However, Tracking Specification is a Temporary table... how can I take info written here to be written to the Reservation Entry Table?
can anyone help?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions