How to Add the data dynamically in Tax Area Location table??
kishi_g
Member Posts: 162
Hi,
I had one doubt. I created locations. By using the below code Tax Area Locations(13761).
IF Loc.FIND('-') THEN
REPEAT
TaxAreaLoc.RESET;
TaxAreaLoc.SETRANGE(Type,TaxAreaLoc.Type::Customer);
TaxAreaLoc.SETRANGE(TaxAreaLoc."Dispatch / Receiving Location",Loc.Code);
IF NOT TaxAreaLoc.FIND('-') THEN BEGIN
TaxAreaLoc.Type := TaxAreaLoc.Type ::Customer;
TaxAreaLoc."VAT Applicable" := TRUE;
TaxAreaLoc."Dispatch / Receiving Location" :=Loc.Code;
TaxAreaLoc."Customer / Vendor Location" := '02';
TaxAreaLoc."Tax Area Code" := 'VAT';
TaxAreaLoc.INSERT;
END;
UNTIL Loc.NEXT = 0;
But how can i modify the data if some fields having data and some fields not having the data. i wrote the code TaxAreaLoc.modify . then i am getting the error.
because In the Tax Area Locations the Primary key is
"Type,Dispatch / Receiving Location,Customer / Vendor Location,VAT Applicable"
How can i modify the data(some fields not having the data).
Thanks & Regards,
kishore...
I had one doubt. I created locations. By using the below code Tax Area Locations(13761).
IF Loc.FIND('-') THEN
REPEAT
TaxAreaLoc.RESET;
TaxAreaLoc.SETRANGE(Type,TaxAreaLoc.Type::Customer);
TaxAreaLoc.SETRANGE(TaxAreaLoc."Dispatch / Receiving Location",Loc.Code);
IF NOT TaxAreaLoc.FIND('-') THEN BEGIN
TaxAreaLoc.Type := TaxAreaLoc.Type ::Customer;
TaxAreaLoc."VAT Applicable" := TRUE;
TaxAreaLoc."Dispatch / Receiving Location" :=Loc.Code;
TaxAreaLoc."Customer / Vendor Location" := '02';
TaxAreaLoc."Tax Area Code" := 'VAT';
TaxAreaLoc.INSERT;
END;
UNTIL Loc.NEXT = 0;
But how can i modify the data if some fields having data and some fields not having the data. i wrote the code TaxAreaLoc.modify . then i am getting the error.
because In the Tax Area Locations the Primary key is
"Type,Dispatch / Receiving Location,Customer / Vendor Location,VAT Applicable"
How can i modify the data(some fields not having the data).
Thanks & Regards,
kishore...
0
Comments
-
By study u'r code I understand that u just modify the taxarealoc table ,so u'have to modify the table not insert .write TaxAreaLoc.Modify .All data will be updataed .
IF you want to insert then also udate the primary key values of table 13761.
You have SETRANGE with Location If than it will give data set with that location .IF TaxAreaLoc."Dispatch / Receiving Location" is available that means data already available in table TaxAreaLoc . SO you have to modify .
TaxAreaLoc.MODIFY;0 -
Hi,
Thanks for ur reply.
if the all fields are empty then we will use TaxAreaLoc.INSERT . it is not a problem. some fileds having data not the all fields when i assign the data from the above code we will use TaxAreaLoc.modify. Here iam getting the error. because all fields are assigned as a primary key.
Thanks & Regards,
kishore...0 -
Write bellow code I think it will work
IF Loc.FIND('-') THEN
REPEAT
TaxAreaLoc.RESET;
TaxAreaLoc.SETRANGE(Type,TaxAreaLoc.Type::Customer);
TaxAreaLoc.SETRANGE(TaxAreaLoc."Dispatch / Receiving Location",Loc.Code);
IF NOT TaxAreaLoc.FIND('-') THEN BEGIN
TaxAreaLoc.Type := TaxAreaLoc.Type ::Customer;
TaxAreaLoc."VAT Applicable" := TRUE;
TaxAreaLoc."Dispatch / Receiving Location" :=Loc.Code;
TaxAreaLoc."Customer / Vendor Location" := '02';
TaxAreaLoc."Tax Area Code" := 'VAT';
TaxAreaLoc.INSERT;
END
ELSE Begin
TaxAreaLoc.Type := "data u want assign" TaxAreaLoc."VAT Applicable" := "data u want assign"
TaxAreaLoc."Dispatch / Receiving Location" :="data u want assign"
TaxAreaLoc."Customer / Vendor Location" := "data u want assign"
TaxAreaLoc."Tax Area Code" := "data u want assign"
TaxAreaLoc.MODIFY;
UNTIL Loc.NEXT = 00 -
Write bellow code I think it will work
IF Loc.FIND('-') THEN
REPEAT
TaxAreaLoc.RESET;
TaxAreaLoc.SETRANGE(Type,TaxAreaLoc.Type::Customer);
TaxAreaLoc.SETRANGE(TaxAreaLoc."Dispatch / Receiving Location",Loc.Code);
IF NOT TaxAreaLoc.FIND('-') THEN BEGIN
TaxAreaLoc.Type := TaxAreaLoc.Type ::Customer;
TaxAreaLoc."VAT Applicable" := TRUE;
TaxAreaLoc."Dispatch / Receiving Location" :=Loc.Code;
TaxAreaLoc."Customer / Vendor Location" := '02';
TaxAreaLoc."Tax Area Code" := 'VAT';
TaxAreaLoc.INSERT;
END
ELSE Begin
TaxAreaLoc.Type := "data u want assign"
TaxAreaLoc."VAT Applicable" := "data u want assign"
TaxAreaLoc."Dispatch / Receiving Location" :="data u want assign"
TaxAreaLoc."Customer / Vendor Location" := "data u want assign"
TaxAreaLoc."Tax Area Code" := "data u want assign"
TaxAreaLoc.MODIFY;
END;
UNTIL Loc.NEXT = 00 -
Sorry my given code also not workable because there all are primary key .It not able to modify .0
-
You should rather use Rename function in that case .0
-
TaxAreaLoc.RENAME;0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions