mibuso.com

Microsoft Business Solutions online community
It is currently Wed May 22, 2013 1:40 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: Datum berekenen
PostPosted: Mon May 23, 2011 2:32 pm 
Offline

Joined: Thu Oct 15, 2009 9:48 am
Posts: 25
Goedemiddag,

Ik heb het volgende stukje code:

Code: Select all
refDate := TODAY;
exprDate := 'CM+13M';
newDate := CALCDATE(exprDate,refDate);


In onze testomgeving werkt het, maar in de Live-omgeving krijg ik de volgende melding:
Quote:
'De datumformule 'CM+13M' moet een tijdseenheid bevatten.'

'Voorbeelden van tijdseenheden: D, WD, W, M, K of J.
'L, lopende tijdseenheid, kan als prefix worden opgegeven bij tijdseenheid.'


De bedoeling is om een datum weer te geven die die 13 maanden verder ligt, en dan de laatste dag van de maand.

Voorbeeld 1:
huidige datum: 23-05-2011
nieuwe datum: 30-06-2012

Voorbeeld 2:
huidige datum: 10-04-2011
nieuwe datum: 31-05-2012

Het vreemde is dat het in de ene omgeving dus werkt en in de andere niet. De Navision versie is sowieso gelijk, en voor zover ik weet zijn alle objecten verder ook gelijk. Zou het aan een taalinstelling oid kunnen liggen?

edit:
Na iets verder gekeken te hebben :oops: zie ik dat het bij sommige orders in de Live-omgeving ook werkt.

edit2:
In het nederlands moet het dus LM zijn, terwijl het engels CM nodig heeft. Wat is hier nu de universele benaming voor?


Top
 Profile E-mail  
 
 Post subject: Re: Datum berekenen
PostPosted: Mon May 23, 2011 2:42 pm 
Online
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4224
Location: New Delhi
Country: India (in)
Use
Quote:
exprDate := '<CM+13M>';



Help says :

Quote:
For example, if a user with language set to ENG (English) enters the date formula "1W+1D" for one week and one day, then a user with the language set to FRA (French) sees "1S+1J," and a user with the language set to ESP (Spanish) sees "1S+1D".

If a date formula is entered with < > delimiters surrounding it, then the date formula is stored in a generic, nonlanguage-dependent format. This makes it possible to develop date formulas that are not dependent on the currently selected language.

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Last edited by mohana_cse06 on Mon May 23, 2011 2:43 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Datum berekenen
PostPosted: Mon May 23, 2011 2:43 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Thu Jan 02, 2003 6:37 pm
Posts: 7931
Location: Howell, MI
Country: United States (us)
Code: Select all
exprDate := '<CM+13M>';

<edit> got beat by mohana :mrgreen: </edit>

_________________
Daniel Rimmelzwaan
MVP - Dynamics NAV


Top
 Profile  
 
 Post subject: Re: Datum berekenen
PostPosted: Mon May 30, 2011 11:53 am 
Offline

Joined: Thu Oct 15, 2009 9:48 am
Posts: 25
Bedankt, met de <> werkt het inderdaad!


Top
 Profile E-mail  
 
 Post subject: Re: Datum berekenen
PostPosted: Mon May 30, 2011 11:58 am 
Online
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4224
Location: New Delhi
Country: India (in)
welkom

(Forgive me if "welcome" is wrong. I dont know Dutch but using google translator read your post and replied :D )

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Datum berekenen
PostPosted: Tue Sep 13, 2011 10:04 am 
Offline

Joined: Thu Oct 15, 2009 9:48 am
Posts: 25
Even een flinke schop tegen mijn eigen vraag, maar nu met wat verdieping...

Is het mogelijk om in
Code: Select all
exprDate := '<CM+13M>';
de "13M" te vervangen door een variabele?

Uiteraard heb ik dat al geprobeerd, maar ik krijg dan een melding: "De datumformule moet een tijdseenheid bevaten."


Top
 Profile E-mail  
 
 Post subject: Re: Datum berekenen
PostPosted: Tue Sep 13, 2011 11:25 am 
Online
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4224
Location: New Delhi
Country: India (in)
try something like

Code: Select all
EVALUATE(PerLen2,format(PerLen));
Datef := '<CM' + '+' + FORMAT(PerLen2) + '>';
Message('%1',Datef);
exprDate := CALCDATE(Datef,TODAY);
Message('%1',exprDate);


where PerLen and PerLen2 are DateFormula datatypes
Datef is text
exprDate is date

I got PerLen from request form

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Datum berekenen
PostPosted: Tue Sep 13, 2011 1:36 pm 
Offline

Joined: Thu Oct 15, 2009 9:48 am
Posts: 25
mohana_cse06 wrote:
try something like

Code: Select all
EVALUATE(PerLen2,format(PerLen));
Datef := '<CM' + '+' + FORMAT(PerLen2) + '>';
Message('%1',Datef);
exprDate := CALCDATE(Datef,TODAY);
Message('%1',exprDate);


where PerLen and PerLen2 are DateFormula datatypes
Datef is text
exprDate is date

I got PerLen from request form

Bedankt, hier kom ik een stuk verder mee.

Is het ook mogelijk om PerLen op te geven in de code? Hoe geef je een DateFormula op in code?


Top
 Profile E-mail  
 
 Post subject: Re: Datum berekenen
PostPosted: Tue Sep 13, 2011 1:52 pm 
Online
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4224
Location: New Delhi
Country: India (in)
Sorry!!
Do you mean you want to assign a value to DateFormula variable through code?
like
Code: Select all
PerLen := '13M'

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Datum berekenen
PostPosted: Tue Sep 13, 2011 1:58 pm 
Offline

Joined: Thu Oct 15, 2009 9:48 am
Posts: 25
Dat bedoel ik inderdaad, bij bovenstaand voorbeeld krijg ik de melding DateFormula := Text.


Top
 Profile E-mail  
 
 Post subject: Re: Datum berekenen
PostPosted: Tue Sep 13, 2011 2:02 pm 
Online
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4224
Location: New Delhi
Country: India (in)
try

Code: Select all
test := '12M';
Datef := '<CM' + '+' + test + '>';
Message('%1',Datef);
exprDate := CALCDATE(Datef,TODAY);
Message('%1',exprDate);


test is a text type variable..

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Datum berekenen
PostPosted: Tue Sep 13, 2011 3:08 pm 
Offline

Joined: Thu Oct 15, 2009 9:48 am
Posts: 25
Geweldig, ik ben er uit!

Daarnaast heb ik de formule nog omgedraaid zodat ik echt de laatste dag van de maand heb, dus '6M + CM' ipv 'CM + 6M'.


Top
 Profile E-mail  
 
 Post subject: Re: Datum berekenen
PostPosted: Tue Sep 13, 2011 4:21 pm 
Online
MVP Microsoft Dynamics NAV

Joined: Tue Sep 02, 2008 8:37 am
Posts: 4224
Location: New Delhi
Country: India (in)
Sorry again..(translator didnt help me 100%)
your problem got solved or not? :-k

_________________
-Mohana
http://mibuso.com/blogs/mohana
http://mohana-dynamicsnav.blogspot.in/


Top
 Profile  
 
 Post subject: Re: Datum berekenen
PostPosted: Wed Sep 14, 2011 11:18 am 
Offline

Joined: Thu Oct 30, 2008 10:38 am
Posts: 987
Location: Earth
Country: Netherlands (nl)
His problem got resolved
Zijn probleem is opgelost.
उसकी समस्या हल हो गया है

_________________
|Pressing F1 is so much faster than opening your browser|
|MCBMSS: 5.0 intro|MCTS:NAV09 839..841|JetReports© Certified Specialist|
|Dynamics Anywhere: Mobile Business Solutions|


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: