Convert Code to Integer
Comments
-
awarn wrote:What version are you on?
FINDFIRST will only work from 4.0 SP3 and up, if you are using earlier then use FIND('-') instead of FINDFIRST
-aNAV - Norton Anti Virus
ERP Consultant (not just Navision) & Navision challenger0 -
Hi DarkHorse:
Try a REPEAT / UNTIL Next=0 after FIND('-')Thanks a lot.0 -
Thanks for reply, but the result is the same; it always shows me the message "must send interaction 3"m, even if I did it. This is the code.
Thanls in advance for help.
interaccion.INIT;
interaccion.RESET;
interaccion.SETCURRENTKEY("Contact No.","Correspondence Type","E-Mail Logged",Subject);
interaccion.SETRANGE("Contact No.",Cont."No.");
IF interaccion.FIND('-') THEN BEGIN
REPEAT IF interaccion."Interaction Template Code" = '3' THEN
CreateCustomer(ChooseCustomerTemplate)
ELSE
ERROR(must send interaction 3');
UNTIL interaccion.NEXT=0;
END;0 -
Try this -
interaccion.INIT;
interaccion.RESET;
interaccion.SETCURRENTKEY("Contact No.","Correspondence Type","E-Mail Logged",Subject);
interaccion.SETRANGE("Contact No.",Cont."No.");
interaccion.SETFILTER("Interaction Template Code",'%1',3);
IF interaccion.FIND('-') THEN BEGIN
CreateCustomer(ChooseCustomerTemplate)
ELSE
ERROR(must send interaction 3');
END;Regards,
Sunil0 -
Thank you very much, but it stops in interaccion.SETFILTER("Interaction Template Code",'%1',3); saying that is impossible to do the conversion Code:Integer and I can't save it.
Thanks for help.0 -
Either:
interaccion.SETFILTER("Interaction Template Code",'%1',FORMAT(3)); // FORMAT translates any variable into a text string
orinteraccion.SETFILTER("Interaction Template Code",'%1','3'); // the '' will make it so NAV interprets it as a text string
orinteraccion.SETRANGE("Interaction Template Code",3); // SETRANGE converts types automatically
0 -
Thanks for reply and for explanation. I know that i'm turning tiresome, I'm sorry.
If I put interaccion.SETFILTER("Interaction Template Code",'%1',FORMAT(3)); it says me that on ELSE instruction should be the END instruction; I'm trying put it but I can't find the way.
Thanks.0 -
IF interaccion.FIND('-') THEN BEGIN
CreateCustomer(ChooseCustomerTemplate)
ELSE
ERROR(must send interaction 3') //remove semicolon
END;Regards,
Sunil0 -
Thanks, but it is removed, the code follows as this:
interaccion.INIT;
interaccion.RESET;
interaccion.SETCURRENTKEY("Contact No.","Correspondence Type","E-Mail Logged",Subject);
interaccion.SETRANGE("Contact No.",Cont."No.");
interaccion.SETFILTER("Interaction Template Code",'1%',FORMAT(3));
IF interaccion.FIND('-') THEN BEGIN
CreateCustomer(ChooseCustomerTemplate)
ELSE
ERROR('must send interaction 3')
END;0 -
Is it giving error?Regards,
Sunil0 -
Indent your code to find out where to put the BEGIN and END (in this case not needed).
interaccion.INIT;
interaccion.RESET;
interaccion.SETCURRENTKEY("Contact No.","Correspondence Type","E-Mail Logged",Subject);
interaccion.SETRANGE("Contact No.",Cont."No.");
interaccion.SETFILTER("Interaction Template Code",'1%',FORMAT(3));
IF interaccion.FIND('-') THEN
CreateCustomer(ChooseCustomerTemplate) //no semicolon
ELSE
ERROR('must send interaction 3'); //semicolon to end the IF line0 -
I'm sorry, now it works correct, but it goes on show me the message "must send interaction 3" even if I did it. It's a madness, I don't know what's the problem.
Thanks everybody for help.0 -
are you sure the interaction template code with value 3 exists in the table?Regards,
Sunil0 -
Any time that you do a BEGIN, you must match it with an END.
IF interaccion.FIND('-') THEN BEGIN CreateCustomer(ChooseCustomerTemplate) ELSE ERROR('must send interaction 3') END;
There is no END to mark the end of the TRUE leg of your IF statement. Try this:IF interaccion.FIND('-') THEN BEGIN CreateCustomer(ChooseCustomerTemplate); END ELSE BEGIN ERROR('must send interaction 3'); END;
Note that in the middle I replaced "ELSE" by "END ELSE BEGIN". Maybe for your eyes it makes more sense like this:IF interaccion.FIND('-') THEN BEGIN CreateCustomer(ChooseCustomerTemplate); END; ELSE BEGIN ERROR('must send interaction 3'); END;
Don't forget to add a semicolon ( ; ) at the end of each complete statement.0 -
sunct wrote:IF interaccion.FIND('-') THEN BEGIN
CreateCustomer(ChooseCustomerTemplate)
ELSE
ERROR(must send interaction 3') //remove semicolon
END;0 -
That Begin is not required thereRegards,
Sunil0 -
But you put it there, so then you have to match it with an END. Every BEGIN must have a matching END. Either you remove the BEGIN at the start of the code as well as the END at the end of the code, or you add END and another BEGIN in the middle.
So either:IF interaccion.FIND('-') THEN BEGIN CreateCustomer(ChooseCustomerTemplate); END ELSE BEGIN ERROR(must send interaction 3'); END;
orIF interaccion.FIND('-') THEN CreateCustomer(ChooseCustomerTemplate) ELSE ERROR(must send interaction 3');
Personally I like the first one, because then you can add code without having to think about BEGIN and END statements.0 -
Thanks everybody for help. Aswering your questions interaction 3 exist. I've tried all the convinations and the result always is the same, it always shows me the message "you must send interaction 3" even if I did it. I don't know what more can I do.
Thanks sincerely for help.0 -
The real question is, does interaction 3 exist for that particular contact. the code is saying no0
-
Yes, I know it's strange, but by all means exist for that contact. If sameone is interest I can send the screen captures.
Thanks for reply.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