elsenorjose
Technical User
Can someone shed some light on why one would use variables like this in a selection formula? I inherited a report with the following and it seems like a really convoluted way of doing things but maybe there's a good reason.
Code:
stringVar localPlantArea := "*";
stringVar localProcess := "*";
stringVar localProduct := "*";
stringVar localStatus := "*";
stringVar localIssueType := "*";
stringVar localOrgUnit := "*";
stringVar localOwner := "*";
if {?PlantArea} <> "" then localPlantArea := {?PlantArea};
if {?IssueType} <> "" then localIssueType := {?IssueType};
if {?OrgUnit} <> "" then localOrgUnit := {?OrgUnit};
if {?Owner} <> "" then localOwner := {?Owner};
if {?Process} <> "" then localProcess := {?Process};
if {?Product} <> "" then localProduct := {?Product};
if {?Status} <> "" then localStatus := {?Status};
//
{V_QEI_QEX_ISSUE.DOC_ORG_ID} in {?OrgID} and
(if not(localIssueType="*")then {V_QEI_QEX_ISSUE.QEI_ITY_NAME}=localIssueType else true) and
(if not(localPlantArea="*")then {V_QEI_QEX_ISSUE.QEI_PLA_CODE}=localPlantArea else true) and
(if not(localOrgUnit="*")then {V_QEI_QEX_ISSUE.QEI_ORU_CODE}=localOrgUnit
else true) and
(if not(localOwner="*")then {V_QEI_QEX_ISSUE.DOC_OWNER_CODE}=localOwner
else true) and
(if not(localProcess="*")then {V_QEI_QEX_ISSUE.QEI_PRC_CODE}=localProcess
else true) and
(if not(localProduct="*")then {V_QEI_QEX_ISSUE.QEI_PRD_NAME}=localProduct
else true) and
(if not(localStatus="*")then {VH_QEI_QEX_ISSUE.DOC_STATUS}=localStatus
else true) and
(if({?FromCreateDate} <> "" )then
date({V_QEI_QEX_ISSUE.DOC_CREATED_DATE})>=date({?FromCreateDate}) else
true) and
(if({?ToCreateDate} <> "" )then date({V_QEI_QEX_ISSUE.DOC_CREATED_DATE})
<=date({?ToCreateDate}) else true) and
(if({?FromCloseDate} <> "" )then
date({V_QEI_QEX_ISSUE.QEI_CLOSED_DATE})>=date({?FromCloseDate}) else true)
and
(if({?ToCloseDate} <> "" )then date({V_QEI_QEX_ISSUE.QEI_CLOSED_DATE})
<=date({?ToCloseDate}) else true)