Need help using the INCSTR function

Demonic240
Member Posts: 65
I have code behind a button on a form that is supposed to create a Vendor Invoice No. each time it is run. The invoice no. is based on the WORKDATE. At the top of my code for my button I have this:
The DELCHR works fine, but for some reason I can not figure out how to get the number to change each time the button is run. Please help.
STR:=DELCHR('EXPRT'+FORMAT(WORKDATE)+'-1','=','/'); PH.SETFILTER("Buy-from Vendor No.",EmployeeExpense3."Employee No."); PH.SETFILTER("Posting Date",FORMAT(WORKDATE)); IF PH.FINDFIRST THEN STR:=INCSTR(STR);
The DELCHR works fine, but for some reason I can not figure out how to get the number to change each time the button is run. Please help.
0
Comments
-
0
-
Thanks, I looked into that thread and experimented with it. I don't think it's exactly what I'm looking for.0
-
something like?
i := -1;
PH.SETFILTER("Buy-from Vendor No.",EmployeeExpense3."Employee No.");
PH.SETFILTER("Posting Date",FORMAT(WORKDATE));
IF PH.FINDFIRST THEN BEGIN
i += 1;
STR:=DELCHR('EXPRT'+FORMAT(WORKDATE)+FORMAT(i),'=','/');
END;Ufuk Asci
Pargesoft0 -
something like?
i := -1;
PH.SETFILTER("Buy-from Vendor No.",EmployeeExpense3."Employee No.");
PH.SETFILTER("Posting Date",FORMAT(WORKDATE));
IF PH.FINDFIRST THEN BEGIN
i += 1;
STR:=DELCHR('EXPRT'+FORMAT(WORKDATE)+FORMAT(i),'=','/');
END;Ufuk Asci
Pargesoft0 -
I think what I need to do is find a way to check another record for the last string. If it's there then it needs to add 1 to the end of the new string. The other idea I had was storing the number in the string somehow on the table. But then how could I make it start over on the next workdate?0
-
I think this might be closer to what I need but it's still not working.
PH.SETFILTER("Buy-from Vendor No.",EmployeeExpense3."Employee No."); PH.SETFILTER("Posting Date",FORMAT(WORKDATE)); IF PH.FINDLAST THEN BEGIN STR:=PH."Vendor Invoice No."; STR:=INCSTR(STR) END;
Edit:
Ok this is working, however I have to run it twice. The first time it tries to use the previous STR. The second time it uses the next one.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