Converting Service Period to Days

Trevor_Norcross
Member Posts: 29
Rookie dev question here.. Trying to come up with the code that converts a service period (ie 30D, 1Q. 1Y) into days. For example if the user enters 1Q, I want the onValidate trigger to convert that to 90D. Not sure what the command or syntax is I am looking for. Thank you!
Trevor Norcross
SharePoint Implementation and Development
Network Administration
Mirifex Systems
SharePoint Implementation and Development
Network Administration
Mirifex Systems
0
Comments
-
In the TextBox put this code on trigger
OnAfterInput(VAR Text : Text[1024];) date1:=WORKDATE;//any date date2 := CALCDATE(Text,date1); Text := FORMAT(date2-date1)+'D';
It works. I tried0 -
OK that does work, thank you... now what if I wanted to put that text variable back into the table as a dateformula... how can I convert from a text variable to a dateformula?Trevor Norcross
SharePoint Implementation and Development
Network Administration
Mirifex Systems0 -
???
Text is variable VarRef:OnAfterInput(VAR Text : Text[1024];)
So you put that text variable back in tableText := FORMAT(date2-date1)+'D';
But how to convert text into dateformula at triger OnValidate, for example, I don't know.
May be somebody else have idea?0 -
I think you understand what I'm trying to do now... using your code, I now have a text variable with some value such as '10D' and I want to change a DateFormula field in a table to have this text variable's value.Trevor Norcross
SharePoint Implementation and Development
Network Administration
Mirifex Systems0 -
EVALUATE(DateFormula,Text)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