I have created a simple report for a vb.net application pulling from SQL server 2005. My dev environment is MS Studio 2005.
BACKGROUND
I have created a formula to display a customers primary or secondary address based on the current date. For example, when a property owner has 2 homes, the formula will display HOME A address or HOME B address based on today's date against home A and B residing dates. Also, there is an expiration date on the second home much like your credit card.
Good News is i have the formula working and displaying either the primary or secondary addresses PROPERLY as long as there is secondary address DATE data. In the instance that the Database is not contain data in the alternate Address BEGIN DATE, END DATE, or TERM YEAR fields (which could be NULL, the formula will not display the primary address information as I am attempting to have it do.
Basic concept of the decision structure i built was to check to see if the current year was <= the expiration year. If it was, run the checks to figure out which address to display (this part works well). ELSE if the current year was > the expiration year, display the PRIMARY ADDRESS.
it is this last ELSE section that i cannot get to display.
CODE:
local stringVar address;
local numberVar begindate;
local numberVar enddate;
local numberVar termyear;
local numberVar todaydate;
local numberVar currentyear;
begindate:= CDbl({AlternateAddress.Beg
inDate});
enddate:= CDbl({AlternateAddress.End
Date});
termyear:= CDbl({AlternateAddress.Ter
mYear});
todaydate:= CDbl(Right(ToText(CurrentD
ate, "yyyyMMdd"), 4));
currentyear:= CDbl(Left(ToText(CurrentDa
te, "yyyyMMdd"), 4));
if currentyear <= termyear then
(
if (todaydate >= begindate) and (todaydate <= enddate) then
(
address:= {AlternateAddress.AltAddre
ss1} + chr(13);
if not isnull ({AlternateAddress.AltAddr
ess2}) then
(
address:=address + {AlternateAddress.AltAddre
ss2} + chr(13);
);
address:= address + chr(10) + {AlternateAddress.AltCity}
& ', ' & {AlternateAddress.AltState
} & '. ' & {AlternateAddress.AltZipCo
de};
address;
)
else
(
address:= {Property.PropAddress1} + chr(13);
if not isnull ({Property.PropAddress2}) then
(
address:=address + {Property.PropAddress2} + chr(13);
);
address:= address + chr(10) + {Property.PropCity} & ', ' & {Property.PropState} & '. ' & {Property.PropZipCode};
address;
)
)
else
(
address:= {Property.PropAddress1} + chr(13);
if not isnull ({Property.PropAddress2}) then
(
address:=address + {Property.PropAddress2} + chr(13);
);
address:= address + chr(10) + {Property.PropCity} & ', ' & {Property.PropState} & '. ' & {Property.PropZipCode};
address;
);
Please help
Thank you in advance
Start Free Trial