Putting an integer in a code variable

sarmig
Member Posts: 89
Hi.
I'm having a big problem with a probably small thing...
How do I put an integer (like 1) in a field of type code?
I'm having a big problem with a probably small thing...
How do I put an integer (like 1) in a field of type code?
0
Comments
-
Did you try
Code := FORMAT(Integer)?0 -
It's not working. My objective is that when I open a form (the Routing Line form), the operation number appears. The operation number, since there's only one entry per item, is always 1. This is what I have from the processing report from yesterday (in the item data item):
RecRoutingLine.RESET; RecRoutingLine.SETRANGE("Routing No.","No."); IF RecRoutingLine.FINDSET THEN BEGIN IF "Tempo Fabrico Machos" > 0 THEN BEGIN RecRoutingLine."Run Time" := "Tempo Fabrico Machos"; RecRoutingLine.MODIFY; MESSAGE('%1', RecRoutingLine."Run Time"); END END ELSE BEGIN RecRoutingHeader.RESET; RecRoutingHeader.SETRANGE("No.","No."); RecRoutingHeader."No." := "No."; //Nº da tabela item RecRoutingHeader.Description := Description; RecRoutingHeader.INSERT; RecRoutingHeader.Status := RecRoutingHeader.Status::Certified; RecRoutingHeader.MODIFY; RecRoutingLine.RESET; RecRoutingLine.SETRANGE("Routing No.","No."); RecRoutingLine."Routing No." := "No."; //Nº da tabela item RecRoutingLine."Work Center No." := "Work Center No."; RecRoutingLine."Work Center Group Code" := "Work Center Group Code"; RecRoutingLine."Operation No." := FORMAT(1); RecRoutingLine."Run Time" := "Tempo Fabrico Machos"; RecRoutingLine.INSERT; IF "Tempo Fabrico Machos" > 0 THEN BEGIN RecRoutingLine."Run Time" := "Tempo Fabrico Machos"; RecRoutingLine.MODIFY; END END
0 -
Removed by myself as it is not good solution--
Regards,
Raveendran.BS0 -
sarmig wrote:It's not working.
What are you expecting from Not Working?
your question is to insert integer in Code..
FORMAT works perfectly for that..
if it is not working in your scenario means you have identify the mistake in your code..0 -
This code worked for me..
RecRoutingLine.RESET; RecRoutingLine.SETRANGE("Routing No.","No."); IF RecRoutingLine.FINDSET THEN BEGIN IF "Tempo Fabrico Machos" > 0 THEN BEGIN RecRoutingLine."Run Time" := "Tempo Fabrico Machos"; RecRoutingLine.MODIFY; MESSAGE('%1', RecRoutingLine."Run Time"); END END ELSE BEGIN RecRoutingHeader.RESET; //RecRoutingHeader.SETRANGE("No.","No."); RecRoutingHeader."No." := "No."; //Nº da tabela item RecRoutingHeader.Description := Description; RecRoutingHeader.INSERT; RecRoutingHeader.Status := RecRoutingHeader.Status::Certified; RecRoutingHeader.MODIFY; RecRoutingLine.RESET; //RecRoutingLine.SETRANGE("Routing No.","No."); RecRoutingLine."Routing No." := "No."; //Nº da tabela item RecRoutingLine."Work Center No." := "Work Center No."; RecRoutingLine."Work Center Group Code" := "Work Center Group Code"; RecRoutingLine."Operation No." := FORMAT(1); RecRoutingLine."Run Time" := "Tempo Fabrico Machos"; RecRoutingLine.INSERT; IF "Tempo Fabrico Machos" > 0 THEN BEGIN RecRoutingLine."Run Time" := "Tempo Fabrico Machos"; RecRoutingLine.MODIFY; END; END;
0 -
The problem is that the field Operation No. in the Routing Line form has nothing, and I want '1' to appear there.0
-
sarmig wrote:The problem is that the field Operation No. in the Routing Line form has nothing, and I want '1' to appear there.
With the above code, if I didnt get routing lines with item then it will create header and lines with operation No 1..
and it is working..
you have to identify why these solutions are not working for you..0 -
I'm having no idea...0
-
Did you try with the code which i have given? (I have modified some code of yours)0
-
I did. I noticed you eliminated some setranges...0
-
are you sure you dont have Routing Header and Lines for the Item which you are runnig?
create a new item and try..0 -
You were right. The item I was testing with already had a Routing Line and Header, although I really don't know how it was created (my supervisor told me these were not created automatically). I got it. Sorry for bothering. Thank you for helping me!0
-
-
By the way, where should I add another
RecRoutingLine."Operation No." := FORMAT(1);
so that I can insert an operating number to the items that already have a Routing Line and Header. I tried to do it here:IF RecRoutingLine.FINDSET THEN BEGIN IF "Tempo Fabrico Machos" > 0 THEN BEGIN RecRoutingLine."Run Time" := "Tempo Fabrico Machos"; RecRoutingLine."Operation No." := FORMAT(1); RecRoutingLine.MODIFY;
but it's not working.0 -
Operation No. is part of primary key..so we cannot do it like this..
we have to delete the line and insert again0
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