hougaard / Simple-Object-Designer

Issue tracking for the Simple Object Designer for Business Central
7 stars 0 forks source link

Unable to get current week of the year #262

Open RGI100 opened 1 year ago

RGI100 commented 1 year ago

With the release of the date calculation field I have been trying to get the current week of the year based on the start date of a production order. The following article explains how to calculate this : https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/system/system-date2dwy-method

If i try adding a datetime field calculation in simple object designer i get an invalid date type field. If i use a date field i get an error as follows:

However when i try this calculation I get the following error: If requesting support, please provide the following details to help troubleshooting:

The date formula 'DATE2DWY' should include a time unit.

Time units can be: D,WD,W,M,Q, or Y. C, meaning current time unit based on date, can be specified as a prefix to the time unit.

Internal session ID: 45856bde-c20f-430d-9cbc-456da9c32fc8

Application Insights session ID: 36fccabd-0da4-4016-b2fa-6eea01d21f47

Client activity id: acf8124b-625a-4f77-a6f1-cb3d9b75b218

Time stamp on error: 2023-08-11T22:57:14.9808055Z

AL call stack: Interpreter_Hgd(CodeUnit 70310401).BuiltInFunctions line 86 - AL Compiler and Interpreter by Hougaard Interpreter_Hgd(CodeUnit 70310401).EvalFunction line 52 - AL Compiler and Interpreter by Hougaard Interpreter_Hgd(CodeUnit 70310401).Eval line 22 - AL Compiler and Interpreter by Hougaard "Edit Expression Hgd"(Page 70310308).VerifyExpression line 39 - Simple Object Designer by Hougaard "Edit Expression Hgd"(Page 70310308)."TestField - OnDrillDown"(Trigger) line 2 - Simple Object Designer by Hougaard

The formula i tried is as follows: CalcDate('Date2DWY'("Starting Date", 2))

Is it possible to calculate the current week of the year with this new feature ?

hougaard commented 1 year ago

date2dwy(Rec."Starting Date",2) should you the week number (Assuming "Starting Date" is a field and the calculated field type is integer)

RGI100 commented 1 year ago

Thank you Erik, it worked.

Lindsay Smith Director of Information Systems

[Logo Description automatically generated] TEAMWORK~OWN IT~POSITIVITY [Marker with solid @.,-122.0125659,14z/data=!3m1!4b1!4m9!4m8!1m1!4e1!1m5!1m1!1s0x5484476c166f84c7:0x180398ab30dc54e9!2m2!1d-122.0128322!2d49.1177372>43756 South Sumas, Chilliwack, B.C. V2R 4L6 [Receiver with solid fill]778-704-0734 Ext. 109 [Smart Phone with solid fill]778-808-7006 Telephone with solid fill 866-8100 [Cursor with solid fill]http://www.rainbow.ca/www.rainbow.cahttp://www.rainbow.ca/ @*.**@*.https://www.instagram.com/rainbowgreenhouses/ @. https://www.linkedin.com/company/rainbow-greenhouses/mycompany/ @.*** https://www.youtube.com/channel/UC3WQpUA2p-Ghl5drqR7X4AQ

From: Erik Hougaard @.> Sent: Saturday, August 12, 2023 10:43 AM To: hougaard/Simple-Object-Designer @.> Cc: Lindsay Smith @.>; Author @.> Subject: Re: [hougaard/Simple-Object-Designer] Unable to get current week of the year (Issue #262)

date2dwy(Rec."Starting Date",2) should you the week number (Assuming "Starting Date" is a field and the calculated field type is integer)

— Reply to this email directly, view it on GitHubhttps://github.com/hougaard/Simple-Object-Designer/issues/262#issuecomment-1676026069, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A3DRB2TN4B4XS6KDJYI7F5DXU66B7ANCNFSM6AAAAAA3NP43LY. You are receiving this because you authored the thread.Message ID: @.**@.>>