I can't see any problem in what you are trying to do.
A default value can be any legal VFP expression. The only rule is that it must return the same data type as the parent field. Since your expression returns a numeric value, and the field in question (taba) is also numeric, it should work as expected.
What problem are you seeing? Is there an error message?
That said, while it should work for INSERT, it probably won't do what you want with APPEND BLANK, as the dependent field (date_sal) won't have a value at the point where the default kicks in.
Mike
__________________________________
Mike Lewis (Edinburgh, Scotland)
What you call message is your default value expression. With "message", Mike meant the error message you get displayed when trying to set that default value expression, but it helps to see the full expression, too, as the screenshot cuts that off and the selected line is unreadable for me on my large display, much too small. So thanks for that essential info, it always helps to provide code as text and not screenshot.
You simply make the wrong usage of the date() function, I initially linked to the definition you'd need to use.
A date literal - a date value needing no function like DATE() to be created - also is possible, that would have the format {^YYYY-MM-DD} in VFP, so perhaps the shortest possible way to do that is:
[tt]iif(date_sal={^2017-07-01},1000,0)[/tt]
Your initial post indicates you want this for two dates, also for 01/01/2017, that could be done with an ICASE, which would also allow assigning different default values per date:
[tt]icase(date_sal={^2017-07-01},1000,date_sal={^2017-01-01},1000,0)[/tt]
or for the same default you may use
[tt]iif(date_sal={^2017-07-01} OR date_sal={^2017-07-01},1000,0)[/tt]
But surely you will not use
[tt]iif(date_sal={^2017-07-01} AND date_sal={^2017-07-01},1000,0)[/tt]
or
[tt]iif(date_sal={^2017-07-01} AND {^2017-07-01},1000,0)[/tt]
If you have any legacy VFP background, what you had in mind when you wrote date(01/07/2017) might have been CTOD('01/07/2017'), but I would not recommend that, as it depends on settings, different countries have different formats for dates, not only in the order of day and month. {^YYYY-MM-DD} is a universal way to write a date independent of such regional differences.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.