Empty Date Formula field

I would like to empty the field Item.“Lead Time Calculation” for a selected number of items with a report. In the OnAfterGetRecord I wrote: Item."Lead Time Calculation" := 0D; MODIFY; However, this isn’t allowed, because the types are different (DateFormula := Date). Anyone?

No time to check it but I think clear(Item.“Lead Time Calculation”); MODIFY; If not I will look back and find what I did last time. (Don’t have the database on this computer).

How about Clear(Item.“lead time Calculation”); ? This should do the work. Regards, Frank Too Late [:D]

Navision uses a (global) variable of type dateformula: 0DF This is a blank dateformula Code DateForumla := 0DF; Then it is blank

Thanks Marq, I will do it that way next time. [:D]

I would create a global variable emptydateformula of type dateformula. Item.“Lead Time Calculation” := emptydateformula; Item.modify;

quote:

I would create a global variable emptydateformula of type dateformula. Item.“Lead Time Calculation” := emptydateformula; Item.modify;
Originally posted by ara3n - 2006 Jan 12 : 12:05:00

Yes, that is what I said [8D] Exept Navision calles this variable 0DF

you guys were to fast, I hadn’t seen your post

I do this all the time, open 15 tabs or windows, and sometimes its an hour before I reply. I think its great that we can get multiple solutions to the same issue, it gives us more things to try. I thought mine was the only solution, now I know 3 solutions, I think thats great.

I usualy read and reply directly if I (think) I know the answer. Otherwise I read the answer from someone else and learn from it. Unfortunately I don’t have much time to look things up that I don;t know.

quote:

Navision uses a (global) variable of type dateformula: 0DF This is a blank dateformula Code DateForumla := 0DF; Then it is blank
Originally posted by marq - 2006 Jan 12 : 11:00:17

Wow, using DF is brilliant! Where did you find this information? I can’t find it on the Navision help under DateFormula.

I remember seeing it somewhere in the code. I don;t know where it was. I have to look that up…

Table 5088 Profile Questionnaire Line has one such “0DF” DateFormula variable. And it’s used all over the posting codeunits as a comparison term for Recurring Frequencies.

There is another undocumented story around date formulas: If you need to hardcode (which you should avoid) a date formula, Navision will cause troubles when changing the language: to avoid this put your date formula in english and into brackets . instead of ‘LM+1T’ (which is the german one) put ‘<CM+1D>’ This will always work, regardless which language you choose. Found this in some standard navision code as well.

quote:

Table 5088 Profile Questionnaire Line has one such “0DF” DateFormula variable. And it’s used all over the posting codeunits as a comparison term for Recurring Frequencies.
Originally posted by nelson - 2006 Jan 12 : 19:43:43

Yes, this was exactly the place I got it from![:D]

WOW!!! What many replies to such a simple question. Thank you all guys!

Maybe we should start a new sticky topic titled: “Undocumented Functions in Navision”

Maybe we should start a new sticky topic titled: “Undocumented Functions in Navision”

Good idea [:D] Start it in tips and tricks here… http://www.mbsonline.org/forum/post.asp?method=Topic&FORUM_ID=26

quote:

There is another undocumented story around date formulas: If you need to hardcode (which you should avoid) a date formula, Navision will cause troubles when changing the language: to avoid this put your date formula in english and into brackets . instead of ‘LM+1T’ (which is the german one) put ‘<CM+1D>’ This will always work, regardless which language you choose. Found this in some standard navision code as well.
Originally posted by tb@softsys.at - 2006 Jan 13 : 04:17:06

This feature is in fact documented (excerpt from the Online-Help):

quote:

Using the DateFormula data type The DateExpression can be a field or variable of type Text or Code, and it can be a field or variable of type DateFormula. The benefit of using a DateFormula field or variable is that the date formula becomes language independent. The user simply enters formulas in the currently selected language. The formula is stored in a generic format in field or variable. When the formula needs to be displayed, the actual string displayed will be converted to the currently selected language at this point in time. For example, if a user with language set to ENG (English) enters the date formula “1W+1D” for one week and one day, a user with the language set to FRA (French) will see “1S+1J” and a user with the language set to ESP (Spanish) will see “1S+1D”. If a date formula is entered with < > delimiters surrounding it, the date formula will be stored in a generic, nonlanguage dependent format. This makes it possible to develop date formulas that are not dependent on the currently selected language.