Initvalue day of the week

sarahgabr
Member Posts: 10
Hello,
I would like to set a table field as todays day of the week, how do I do that?
I would like to set a table field as todays day of the week, how do I do that?
0
Answers
-
Virtual Date table... filter on type = Day and Todays date... will show the periodNo = day of week no from memory...0
-
Either you can go with Date Virtual Table ti achieve this OR Have a look on this
https://rockwithnav.wordpress.com/2016/04/14/handle-datetime-use-dotnet-variable/Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
What am I supposed to do with date virtual table, is there a walk through as I am a newbie.0
-
Ok Can you explain your requirement a level more please.
Are you inserting data in a Table and then you want to insert a day of the Week or something else?Thanks
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/0 -
1) Create a function called InitRecord (or something similar) on the table
2) In the InitRecord function, add the following line of code..."Day of Week" := DATE2DWY(TODAY,1);
3) On the Page where uses create new records, call the InitRecord function in the OnNewRecord trigger
4) If you are adding records in code, then...MyTable.INIT; MyTable.InitRecord; ...set additional fields here MyTable.INSERT;
0 -
Note - you can't use the InitValue property for what you want to do because this can only be used to default to fixed values and what you want to do is default to a dynamic value (based on the current day of the week) so that's why you have to do it via the above code.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