Vb code explanation

' Exclude capital construction expenditures
sOut = sOut & "*UNION({[Fund].[Fund Type].&[CP]} * {[Fund].[Fund No].&[435]}"
sOut = sOut & ", EXCEPT([Fund].[Fund Type].[All].CHILDREN,[Fund].[Fund Type].&[CP])"
sOut = sOut & "*[Fund].[Fund No].[All].CHILDREN) "
'else
' Commented out because if it's true, we don't want to limit any results
' sOut = sOut & "*{[Fund].[Fund Type].&[CP]}"
' sOut = sOut & "*EXCEPT([Fund].[Fund No].[All].CHILDREN,[Fund].[Fund No].&[435])"
I know it is to exclude the capital construction expenditure as explained above but can you explain each line.
Thanks.

I was asked to add a new parameter (Project or Non-Project) to a report. The parameter for the summarized report is a dataset from a cube which is to drill through to an expense journal report. The drill through report whose data source is from a database.
For the previous report before adding the parameter it has been returning result, but after adding my parameter it returns nothing because of 1 of the filter selection FUND_NUMBER IN (ALL) but when I put a real value it returns result.I understand why it
is not returning any result. It is because in the database for that column .All is only applicable in dataset from analysis. My question now is I only added my column to the code. I did not touch anything else that reference that column so how come it
is an issue after I added my parameter since I guess the code has been designed to handle such before.
I have added the vb code both for the Monthly trend and Expense Journal. Please if you are good in vb please assist or if you have a suggestion.
I know the code looks lengthy but it is pretty much the same thing when you get the hand work of  1 line.Thanks
Public Function fMonthlyTrendsMDX() as string
Dim sOut as String
Dim iCriteria as Integer = 0
sOut = "SELECT NON EMPTY {[Measures].[" & Report.Parameters!pRevOrExp.Label & " Amount]} ON COLUMNS, NON EMPTY {"
if Report.Parameters!pSummary1.Value="Category_Description" or Report.Parameters!pSummary2.Value="Category_Description" or Report.Parameters!pSummary3.Value="Category_Description" then
sOut = sOut & fPadMDX("[Object].[Category Description].[Category Description].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Object_Description" or Report.Parameters!pSummary2.Value="Object_Description" or Report.Parameters!pSummary3.Value="Object_Description" then
sOut = sOut & fPadMDX("[Object].[Object Description].[Object Description].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Object_Detail_Description" or Report.Parameters!pSummary2.Value="Object_Detail_Description" or Report.Parameters!pSummary3.Value="Object_Detail_Description" then
sOut = sOut & fPadMDX("[Object].[Object Detail Description].[Object Detail Description].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Resp_Unit_Org_Level_1" or Report.Parameters!pSummary2.Value="Resp_Unit_Org_Level_1" or Report.Parameters!pSummary3.Value="Resp_Unit_Org_Level_1" then
sOut = sOut & fPadMDX("[Responsible Unit].[Org Level 1].[Org Level 1].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Resp_Unit_Org_Level_2" or Report.Parameters!pSummary2.Value="Resp_Unit_Org_Level_2" or Report.Parameters!pSummary3.Value="Resp_Unit_Org_Level_2" then
sOut = sOut & fPadMDX("[Responsible Unit].[Org Level 2].[Org Level 2].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Resp_Unit_Org_Level_3" or Report.Parameters!pSummary2.Value="Resp_Unit_Org_Level_3" or Report.Parameters!pSummary3.Value="Resp_Unit_Org_Level_3" then
sOut = sOut & fPadMDX("[Responsible Unit].[Org Level 3].[Org Level 3].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Resp_Org_Unit_Description" or Report.Parameters!pSummary2.Value="Resp_Org_Unit_Description" or Report.Parameters!pSummary3.Value="Resp_Org_Unit_Description" then
sOut = sOut & fPadMDX("[Responsible Unit].[Org Unit].[Org Unit].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
sOut = sOut & fPadMDX("[Responsible Unit].[Org Unit Description].[Org Unit Description].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Resp_Org_Unit" or Report.Parameters!pSummary2.Value="Resp_Org_Unit" or Report.Parameters!pSummary3.Value="Resp_Org_Unit" then
sOut = sOut & fPadMDX("[Responsible Unit].[Org Unit].[Org Unit].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Charge_Unit_Org_Level_1" or Report.Parameters!pSummary2.Value="Charge_Unit_Org_Level_1" or Report.Parameters!pSummary3.Value="Charge_Unit_Org_Level_1" then
sOut = sOut & fPadMDX("[Charge Unit].[Org Level 1].[Org Level 1].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Charge_Unit_Org_Level_2" or Report.Parameters!pSummary2.Value="Charge_Unit_Org_Level_2" or Report.Parameters!pSummary3.Value="Charge_Unit_Org_Level_2" then
sOut = sOut & fPadMDX("[Charge Unit].[Org Level 2].[Org Level 2].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Charge_Unit_Org_Level_3" or Report.Parameters!pSummary2.Value="Charge_Unit_Org_Level_3" or Report.Parameters!pSummary3.Value="Charge_Unit_Org_Level_3" then
sOut = sOut & fPadMDX("[Charge Unit].[Org Level 3].[Org Level 3].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Charge_Org_Unit_Description" or Report.Parameters!pSummary2.Value="Charge_Org_Unit_Description" or Report.Parameters!pSummary3.Value="Charge_Org_Unit_Description" then
sOut = sOut & fPadMDX("[Charge Unit].[Org Unit].[Org Unit].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
sOut = sOut & fPadMDX("[Charge Unit].[Org Unit Description].[Org Unit Description].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Charge_Org_Unit" or Report.Parameters!pSummary2.Value="Charge_Org_Unit" or Report.Parameters!pSummary3.Value="Charge_Org_Unit" then
sOut = sOut & fPadMDX("[Charge Unit].[Org Unit].[Org Unit].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Activity_Description" or Report.Parameters!pSummary2.Value="Activity_Description" or Report.Parameters!pSummary3.Value="Activity_Description" then
sOut = sOut & "NonEmpty([Activity].[Activity Description].[Activity Description].ALLMEMBERS)*"
end if
if Report.Parameters!pSummary1.Value="Appn_Symbol_Description" or Report.Parameters!pSummary2.Value="Appn_Symbol_Description" or Report.Parameters!pSummary3.Value="Appn_Symbol_Description" then
sOut = sOut & fPadMDX("[Appropriation].[Appn Symbol Description].[Appn Symbol Description].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="EA" or Report.Parameters!pSummary2.Value="EA" or Report.Parameters!pSummary3.Value="EA" then
sOut = sOut & fPadMDX("[EA].[EA].[EA]",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="EA_Description" or Report.Parameters!pSummary2.Value="EA_Description" or Report.Parameters!pSummary3.Value="EA_Description" then
sOut = sOut & fPadMDX("[EA].[EA Description].[EA Description]",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="EA_Subjob" or Report.Parameters!pSummary2.Value="EA_Subjob" or Report.Parameters!pSummary3.Value="EA_Subjob" then
sOut = sOut & fPadMDX("[EA].[EA Subjob].[EA Subjob]",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="EA_Class" or Report.Parameters!pSummary2.Value="EA_Class" or Report.Parameters!pSummary3.Value="EA_Class" then
sOut = sOut & fPadMDX("[EA].[Report Class].[Report Class]",Report.Parameters!pRevOrExp.Label) & "*"
end if
if left(Report.Parameters!pSummary1.Value,6)="Rel_EA" or left(Report.Parameters!pSummary2.Value,6)="Rel_EA" or left(Report.Parameters!pSummary3.Value,6)="Rel_EA" then
sOut = sOut & fPadMDX("[EA].[Rel EA Description].[Rel EA Description]",Report.Parameters!pRevOrExp.Label) & "*"
sOut = sOut & fPadMDX("[EA].[Rel EA Subjob].[Rel EA Subjob]",Report.Parameters!pRevOrExp.Label) & "*"
sOut = sOut & fPadMDX("[EA].[Rel EA].[Rel EA]",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Fiscal_Year" or Report.Parameters!pSummary2.Value="Fiscal_Year" or Report.Parameters!pSummary3.Value="Fiscal_Year" then
sOut = sOut & fPadMDX("[Biennium].[Fiscal Year].[Fiscal Year].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Fiscal_Month" or Report.Parameters!pSummary2.Value="Fiscal_Month" or Report.Parameters!pSummary3.Value="Fiscal_Month" then
sOut = sOut & fPadMDX("[Biennium].[Fiscal Month].[Fiscal Month].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Fund_Detail_Description" or Report.Parameters!pSummary2.Value="Fund_Detail_Description" or Report.Parameters!pSummary3.Value="Fund_Detail_Description" then
sOut = sOut & fPadMDX("[Fund].[Fund Detail Description].[Fund Detail Description].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Fund_Detl" or Report.Parameters!pSummary2.Value="Fund_Detl" or Report.Parameters!pSummary3.Value="Fund_Detl" then
sOut = sOut & fPadMDX("[Fund].[Fund Detl].[Fund Detl].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Fund_No_Description" or Report.Parameters!pSummary2.Value="Fund_No_Description" or Report.Parameters!pSummary3.Value="Fund_No_Description" then
sOut = sOut & fPadMDX("[Fund].[Fund No Description].[Fund No Description].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Fund_Source_Description" or Report.Parameters!pSummary2.Value="Fund_Source_Description" or Report.Parameters!pSummary3.Value="Fund_Source_Description" then
sOut = sOut & fPadMDX("[Fund].[Fund Source Description].[Fund Source Description].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
'if Report.Parameters!pSummary1.Value="Fund_Type" or Report.Parameters!pSummary2.Value="Fund_Type" or Report.Parameters!pSummary3.Value="Fund_Type" then
' sOut = sOut & fPadMDX("[Fund].[Fund Type].[Fund Type].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
'end if
if Report.Parameters!pSummary1.Value="Fund_Type_Description" or Report.Parameters!pSummary2.Value="Fund_Type_Description" or Report.Parameters!pSummary3.Value="Fund_Type_Description" then
sOut = sOut & fPadMDX("[Fund].[Fund Type Description].[Fund Type Description].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Trans_Code_Description" or Report.Parameters!pSummary2.Value="Trans_Code_Description" or Report.Parameters!pSummary3.Value="Trans_Code_Description" then
sOut = sOut & fPadMDX("[Transaction Codes].[Trans Code Description].[Trans Code Description].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Trans_Group_Description" or Report.Parameters!pSummary2.Value="Trans_Group_Description" or Report.Parameters!pSummary3.Value="Trans_Group_Description" then
sOut = sOut & fPadMDX("[Transaction Codes].[Trans Group Description].[Trans Group Description].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Agency_Source_Description" or Report.Parameters!pSummary2.Value="Agency_Source_Description" or Report.Parameters!pSummary3.Value="Agency_Source_Description" then
sOut = sOut & fPadMDX("[Revenue Source].[Agency Source Description].[Agency Source Description].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
if Report.Parameters!pSummary1.Value="Revenue_Source_Description" or Report.Parameters!pSummary2.Value="Revenue_Source_Description" or Report.Parameters!pSummary3.Value="Revenue_Source_Description" then
sOut = sOut & fPadMDX("[Revenue Source].[Revenue Source Description].[Revenue Source Description].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
end if
sOut = sOut & fPadMDX("[Biennium].[Biennium Hierarchy].[Bien Name].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
sOut = sOut & fPadMDX("[" & Report.Parameters!pColumnGrouping.Label & "].[Calendar Year].[Calendar Year].ALLMEMBERS",Report.Parameters!pRevOrExp.Label) & "*"
sOut = sOut & fPadMDX("[" & Report.Parameters!pColumnGrouping.Label & "].[Calendar Month].[Calendar Month].ALLMEMBERS",Report.Parameters!pRevOrExp.Label)
if (Report.Parameters!pCapExpenses.Value=False) then
' Exclude capital construction expenditures
sOut = sOut & "*UNION({[Fund].[Fund Type].&[CP]} * {[Fund].[Fund No].&[435]}"
sOut = sOut & ", EXCEPT([Fund].[Fund Type].[All].CHILDREN,[Fund].[Fund Type].&[CP])"
sOut = sOut & "*[Fund].[Fund No].[All].CHILDREN) "
'else
' Commented out because if it's true, we don't want to limit any results
' sOut = sOut & "*{[Fund].[Fund Type].&[CP]}"
' sOut = sOut & "*EXCEPT([Fund].[Fund No].[All].CHILDREN,[Fund].[Fund No].&[435])"
end if
sOut = sOut & "} DIMENSION PROPERTIES MEMBER_CAPTION,MEMBER_UNIQUE_NAME ON ROWS "
if (Report.Parameters!pLastCompletedPeriod.Value="Month") and (Report.Parameters!BienniumBienniumHierarchy.Value(0) = fReturnBienMDX(Now())) then
sOut = sOut & "FROM (SELECT StrToMember('" & Report.Parameters!pFirstDayOfBiennium.Value & "', constrained):StrToMember('"
sOut = sOut & Report.Parameters!pLastFullMonthMDX.Value & "', constrained) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!ActivityDescription.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!ActivityDescription.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!Appropriation.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!Appropriation.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!AgencySrcDesc.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!AgencySrcDesc.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!EA.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!EA.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!EAReportClass.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!EAReportClass.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!EASubJob.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!EASubJob.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!EASubjobDesc.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!EASubjobDesc.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!FundNo.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!FundNo.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!FundNoDescription.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!FundNoDescription.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!FundDetailDescription.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!FundDetailDescription.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!FundDetl.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!FundDetl.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!FiscalMonth.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!FiscalMonth.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!FiscalYear.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!FiscalYear.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!FundSrcDesc.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!FundSrcDesc.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!FundType.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!FundType.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!FundTypeDesc.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!FundTypeDesc.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!RelEA.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!RelEA.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!RelEADesc.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!RelEADesc.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!RelEASubjob.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!RelEASubjob.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!RevenueSrcDesc.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!RevenueSrcDesc.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!TransCode.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!TransCode.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!TransCodeDesc.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!TransCodeDesc.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!TransGroup.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!TransGroup.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!TransGroupDesc.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!TransGroupDesc.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!ObjectCategoryDescription.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!ObjectCategoryDescription.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!ObjectObjectDescription.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!ObjectObjectDescription.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!ObjectDetailDescription.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!ObjectDetailDescription.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!OrgUnitDescription.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & replace(join(Report.Parameters!OrgUnitDescription.value,","),chr(39),chr(39)&chr(39)) & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!OrgLevel1.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & replace(join(Report.Parameters!OrgLevel1.value,","),chr(39),chr(39)&chr(39)) & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!OrgLevel2.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & replace(join(Report.Parameters!OrgLevel2.value,","),chr(39),chr(39)&chr(39)) & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!OrgLevel3.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & replace(join(Report.Parameters!OrgLevel3.value,","),chr(39),chr(39)&chr(39)) & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if not (instr(join(Report.Parameters!BienniumBienniumHierarchy.value,","),"All")>0) then
sOut = sOut & "FROM (SELECT StrToSet('{" & join(Report.Parameters!BienniumBienniumHierarchy.value,",") & "}',CONSTRAINED) ON COLUMNS "
iCriteria = iCriteria + 1
end if
if Report.Parameters!pRevOrExp.Label = "Expenditure" then
sOut = sOut & "from (select ([Transaction Codes].[Trans Group].&[3500]) on columns "
sOut = sOut & "from (select except([Object].[Category Description].members, {[Object].[Category Description].&[9]}) on 0 "
iCriteria = iCriteria + 2
end if
sOut = sOut & "FROM [HMI Finance]" & fStringClone(")", iCriteria)
sOut = sOut & "CELL PROPERTIES VALUE,BACK_COLOR,FORE_COLOR,FORMATTED_VALUE,FORMAT_STRING,FONT_NAME,FONT_SIZE,FONT_FLAGS;"
return sOut
end function
Public Function fGenAuditTrailQuery() as String
' For any Summary or column parms that have EASJ as the value, this is a calculated
' column made up of the EA and SUBJOB columns. Due to this, we need to detect
' when the EASJ value has been selected so we get the EA and SUBJOB columns to use
' in the calculation
' Same with VENDOR_NO_SFX -- calculated column, so we need to grab the appropriate
' columns to create it (VENDOR_NO and VENDOR_SFX)
Dim sOut as String
' Limit results to the pRecordsLimit parameter if it is populated
if Report.Parameters!pRecordsLimit.Value IsNot Nothing then
sOut = "SELECT top " & Report.Parameters!pRecordsLimit.Value & " "
else
sOut = "SELECT "
end if
' Column1 select
if Report.Parameters!pColumn1.Value = "EASJ" then
sOut = sOut & "EA, SUBJOB, "
elseif Report.Parameters!pColumn1.Value = "REL_EASJ" then
sOut = sOut & "REL_EA, REL_SUBJOB, "
elseif LEFT(Report.Parameters!pColumn1.Value,8) = "VENDOR_N" then
sOut = sOut & "VENDOR_NO, VENDOR_SFX, VENDOR_NAME, "
else
sOut = sOut & Report.Parameters!pColumn1.Value & ", "
end if
' Column2 select
if Report.Parameters!pColumn2.Value = "EASJ" then
sOut = sOut & "EA, SUBJOB, "
elseif Report.Parameters!pColumn2.Value = "REL_EASJ" then
sOut = sOut & "REL_EA, REL_SUBJOB, "
elseif LEFT(Report.Parameters!pColumn2.Value,8) = "VENDOR_N" then
sOut = sOut & "VENDOR_NO, VENDOR_SFX, VENDOR_NAME, "
else
sOut = sOut & Report.Parameters!pColumn2.Value & ", "
end if
' Column3 through Column6 select
sOut = sOut & Report.Parameters!pColumn3.Value & ", "
sOut = sOut & Report.Parameters!pColumn4.Value & ", "
sOut = sOut & Report.Parameters!pColumn5.Value & ", "
sOut = sOut & Report.Parameters!pColumn6.Value & ", "
' Column7 select
if Report.Parameters!pColumn7.Value = "EASJ" then
sOut = sOut & "EA, SUBJOB, "
elseif Report.Parameters!pColumn7.Value = "REL_EASJ" then
sOut = sOut & "REL_EA, REL_SUBJOB, "
elseif LEFT(Report.Parameters!pColumn7.Value,8) = "VENDOR_N" then
sOut = sOut & "VENDOR_NO, VENDOR_SFX, VENDOR_NAME, "
else
sOut = sOut & Report.Parameters!pColumn7.Value & ", "
end if
' Column8 select
if Report.Parameters!pColumn8.Value = "EASJ" then
sOut = sOut & "EA, SUBJOB, "
elseif Report.Parameters!pColumn8.Value = "REL_EASJ" then
sOut = sOut & "REL_EA, REL_SUBJOB, "
elseif LEFT(Report.Parameters!pColumn8.Value,8) = "VENDOR_N" then
sOut = sOut & "VENDOR_NO, VENDOR_SFX, VENDOR_NAME, "
else
sOut = sOut & Report.Parameters!pColumn8.Value & ", "
end if
' Column9 select
if Report.Parameters!pColumn9.Value = "EASJ" then
sOut = sOut & "EA, SUBJOB, "
elseif Report.Parameters!pColumn9.Value = "REL_EASJ" then
sOut = sOut & "REL_EA, REL_SUBJOB, "
elseif LEFT(Report.Parameters!pColumn9.Value,8) = "VENDOR_N" then
sOut = sOut & "VENDOR_NO, VENDOR_SFX, VENDOR_NAME, "
else
sOut = sOut & Report.Parameters!pColumn9.Value & ", "
end if
' Include columns if they were used to groupby
if Report.Parameters!pSummary1.Value = "EASJ" then
sOut = sOut & "EA, SUBJOB, "
elseif Report.Parameters!pSummary1.Value = "VENDOR_NO_SFX" then
sOut = sOut & "VENDOR_NO, VENDOR_SFX, "
elseif Report.Parameters!pSummary1.Value="RESPONSIBLE_UNIT" then
sOut = sOut & "RESPONSIBLE_UNIT, "
elseif Report.Parameters!pSummary1.Value="CHRGE_UNIT" then
sOut = sOut & "CHRGE_UNIT, "
elseif Report.Parameters!pSummary1.Value = "REL_EASJ" then
sOut = sOut & "REL_EA, REL_SUBJOB, "
else
sOut = sOut & Report.Parameters!pSummary1.Value & ", "
end if
if Report.Parameters!pSummary2.Value = "EASJ" then
sOut = sOut & "EA, SUBJOB, "
elseif left(Report.Parameters!pSummary2.Value,8) = "VENDOR_N" then
sOut = sOut & "VENDOR_NO, VENDOR_SFX, VENDOR_NAME, "
elseif Report.Parameters!pSummary2.Value="RESPONSIBLE_UNIT" then
sOut = sOut & "RESPONSIBLE_UNIT, "
elseif Report.Parameters!pSummary2.Value="CHRGE_UNIT" then
sOut = sOut & "CHRGE_UNIT, "
elseif Report.Parameters!pSummary2.Value = "REL_EASJ" then
sOut = sOut & "REL_EA, REL_SUBJOB, "
else
sOut = sOut & Report.Parameters!pSummary2.Value & ", "
end if
if Report.Parameters!pSummary3.Value = "EASJ" then
sOut = sOut & "EA, SUBJOB, "
elseif Report.Parameters!pSummary3.Value = "VENDOR_NO_SFX" then
sOut = sOut & "VENDOR_NO, VENDOR_SFX, "
elseif Report.Parameters!pSummary3.Value="RESPONSIBLE_UNIT" then
sOut = sOut & "RESPONSIBLE_UNIT, "
elseif Report.Parameters!pSummary3.Value="CHRGE_UNIT" then
sOut = sOut & "CHRGE_UNIT, "
elseif Report.Parameters!pSummary3.Value = "REL_EASJ" then
sOut = sOut & "REL_EA, REL_SUBJOB, "
else
sOut = sOut & Report.Parameters!pSummary3.Value & ", "
end if
' Always include the following columns
sOut = sOut & " FUND_SPLT_SEQ_NO, DUP_REC_IND, FISCAL_YEAR, FISCAL_MONTH, BATCH_AGENCY, BATCH_DATE, BATCH_TYPE, BATCH_NO, DOC_INDEX, LINE_NO, RECORD_NO, "
sOut = sOut & "ORG_LEVEL, ORG_LEVEL_1, ORG_LEVEL_2, ORG_LEVEL_3, RESP_UNIT_LEVL_1, RESP_UNIT_LEVL_2, RESP_UNIT_LEVL_3,OBJECT, CATEGORY "
' Logic to query the correct audittrail table depends on
' the pBiennium parm and that the audittrail table is named
' appropriately.
' Current biennium should always be STG_FMPROD_V_AUDITTRAIL_CURR
' Previous bienniums are STG_FMPROD_V_AUDITTRAIL_BI_XX
' Someday in the future, this naming schema will have to change
' because the biennium numbering will hit 99, then roll over to 01 again
sOut = sOut & " FROM dbo.STG_FMPROD_V_AUDITTRAIL_"
If Right(fReturnBien(Now()),2) = Right(Report.Parameters!pBiennium.Value, 2) then
' pBiennium value is in the current biennium, use CURR
sOut = sOut & "CURR "
else
' pBiennium value is in a previous biennium, use it
sOut = sOut & "BI_" & Right(Report.Parameters!pBiennium.Value,2) & " "
end if
sOut = sOut & "WHERE"
' We only want expenditures. This could obviously be put into a parm, but for now we just hard coded it
sOut = sOut & " TRANS_CODE IN (SELECT TRANS_CODE FROM STG_FMTMPROD_V_TRANS_DECISION where trans_group = 3500)"
' Per the requirements, we are not including anything from category 9
sOut = sOut & " AND CATEGORY <> '9'"
' Capital expenditures or non-capital expenditures determined here
if (Report.Parameters!pCapExpenses.Value = False) then
' Exclude capital expenditures
sOut = sOut & " AND (FUND_TYPE <> 'CP' or FUND_NUMBER = '435')"
end if
if (Report.Parameters!pDateBegin.Value IsNot Nothing) and (Report.Parameters!pDateEnd.Value IsNot Nothing) Then
sOut = sOut & " AND PROCESS_DATE BETWEEN '" & Report.Parameters!pDateBegin.Value & "'"
sOut = sOut & " AND '" & Report.Parameters!pDateEnd.Value & "'"
end if
if Report.Parameters!RESPONSIBLE_UNIT.Value IsNot Nothing THEN
sOut = sOut & " and RESPONSIBLE_UNIT IN ('" & Replace(Report.Parameters!RESPONSIBLE_UNIT.Value,",","','") & "')"
end if
if Report.Parameters!FISCAL_YEAR.Value IsNot Nothing THEN
sOut = sOut & " and FISCAL_YEAR = '" & Report.Parameters!FISCAL_YEAR.Value & "'"
end if
if Report.Parameters!FISCAL_MONTH.Value IsNot Nothing THEN
sOut = sOut & " and FISCAL_MONTH = '" & Report.Parameters!FISCAL_MONTH.Value & "'"
end if
if Report.Parameters!RESP_UNIT_LEVL_1.Value IsNot Nothing THEN
sOut = sOut & " and RESP_UNIT_LEVL_1 IN ('" & Replace(Report.Parameters!RESP_UNIT_LEVL_1.Value,",","','") & "')"
end if
if Report.Parameters!RESP_UNIT_LEVL_2.Value IsNot Nothing THEN
sOut = sOut & " and RESP_UNIT_LEVL_2 IN ('" & Replace(Report.Parameters!RESP_UNIT_LEVL_2.Value,",","','") & "')"
end if
if Report.Parameters!RESP_UNIT_LEVL_3.Value IsNot Nothing THEN
sOut = sOut & " and RESP_UNIT_LEVL_3 IN ('" & Replace(Report.Parameters!RESP_UNIT_LEVL_3.Value,",","','") & "')"
end if
if Report.Parameters!CHRGE_UNIT.Value IsNot Nothing THEN
sOut = sOut & " and CHRGE_UNIT IN ('" & Replace(Report.Parameters!CHRGE_UNIT.Value,",","','") & "')"
end if
if Report.Parameters!ORG_LEVEL_1.Value IsNot Nothing THEN
sOut = sOut & " and ORG_LEVEL_1 IN ('" & Replace(Report.Parameters!ORG_LEVEL_1.Value,",","','") & "')"
end if
if Report.Parameters!ORG_LEVEL_2.Value IsNot Nothing THEN
sOut = sOut & " and ORG_LEVEL_2 IN ('" & Replace(Report.Parameters!ORG_LEVEL_2.Value, ",","','") & "')"
end if
if Report.Parameters!ORG_LEVEL_3.Value IsNot Nothing THEN
sOut = sOut & " and ORG_LEVEL_3 IN ('" & Replace(Report.Parameters!ORG_LEVEL_3.Value, ",","','") & "')"
end if
if Report.Parameters!CATEGORY.Value IsNot Nothing THEN
sOut = sOut & " and CATEGORY IN ('" & Replace(Report.Parameters!CATEGORY.Value,",","','") & "')"
end if
if Report.Parameters!OBJECT.Value IsNot Nothing THEN
sOut = sOut & " and OBJECT IN ('" & Replace(Report.Parameters!OBJECT.Value, ",","','") & "')"
end if
if Report.Parameters!OBJ_DETL.Value IsNot Nothing THEN
sOut = sOut & " and OBJ_DETL IN ('" & Replace(Report.Parameters!OBJ_DETL.Value, ",","','") & "')"
end if
if Report.Parameters!APPN_SYMBOL.Value IsNot Nothing THEN
sOut = sOut & " and APPN_SYMBOL IN ('" & Replace(Report.Parameters!APPN_SYMBOL.Value,",","','") & "')"
end if
if Report.Parameters!EA.Value IsNot Nothing THEN
' Gotta do some wizardry here in case the EA value contains EA SubJob or EA SubJob Description
sOut = sOut & " and EA IN ('" & Replace(fStripEA(Report.Parameters!EA.Value),",","','") & "')"
if InStr(1, Report.Parameters!EA.Value, " - ")>0 then
' parameter contains subjob, parse that out
sOut = sOut & " and SUBJOB IN ('" & Replace(fStripSJ(Report.Parameters!EA.Value),",","','") & "')"
end if
end if
if Report.Parameters!REL_EA.Value IsNot Nothing THEN
sOut = sOut & " and REL_EA IN ('" & Replace(fStripEA(Report.Parameters!REL_EA.Value),",","','") & "')"
if InStr(1, Report.Parameters!REL_EA.Value, " - ")>0 then
' parameter contains subjob, parse that out
sOut = sOut & " and REL_SUBJOB IN ('" & Replace(fStripSJ(Report.Parameters!REL_EA.Value),",","','") & "')"
end if
end if
if Report.Parameters!ACTIVITY.Value IsNot Nothing THEN
sOut = sOut & " and ACTIVITY IN ('" & Replace(Report.Parameters!ACTIVITY.Value,",","','") & "')"
end if
if Report.Parameters!TRANS_CODE.Value IsNot Nothing THEN
sOut = sOut & " and TRANS_CODE IN ('" & Replace(Report.Parameters!TRANS_CODE.Value,",","','") & "')"
end if
if Report.Parameters!FUND_NUMBER.Value IsNot Nothing THEN
sOut = sOut & " and FUND_NUMBER IN ('" & Replace(Report.Parameters!FUND_NUMBER.Value,",","','") & "')"
end if
if Report.Parameters!FUND_DETAIL.Value IsNot Nothing THEN
sOut = sOut & " and FUND_DETAIL IN ('" & Replace(Report.Parameters!FUND_DETAIL.Value,",","','") & "')"
end if
if Report.Parameters!FUND_SOURCE.Value IsNot Nothing THEN
sOut = sOut & " and FUND_SOURCE IN ('" & Replace(Report.Parameters!FUND_SOURCE.Value,",","','") & "')"
end if
if Report.Parameters!FUND_TYPE.Value IsNot Nothing THEN
sOut = sOut & " and FUND_TYPE IN ('" & Replace(Report.Parameters!FUND_TYPE.Value,",","','") & "')"
end if
sOut = sOut & " ORDER BY PROCESS_DATE DESC"
return sOut
End Function

Similar Messages

  • Improvements to status code explanations requested

    There are some status code explanations in the 9.0.4.x
    CSDK that could probably use some refinement to be more
    useful to application developers.
    Two examples:
    1."CAPI_STAT_LIBRARY_INTERNAL_DATA = There was a corruption of data in the library."
    This might not always indicate that data in the
    calendar store is corrupted - which is the way we
    initially interpreted this error - but rather that
    data provided to be stored is in some way invalid.
    Example: calling storeEvents() with an
    iCalendar whose DTSTART property was after
    DTEND (i.e. start date after ending date),
    returned the status "CAPI_STAT_LIBRARY_INTERNAL_DATA".
    Example: calling Session.storeEvents() with an iCalendar
    whose start and end dates are in a non-UTC TZ in a format
    similar to "DTSTART;TZID=US/Pacific:20040517T101500",
    that method returned "CAPI_STAT_LIBRARY_INTERNAL_DATA".
    Fix: include an appropriate VTIMEZONE component
    for that timezone in the submitted iCalendar.
    2. Any of the explanations below, which begin with
    "Information about ..."
    These often seem to indicate that a data format error
    has occurred, and that the application developer
    needs to modify the format of the data to have it
    accepted. The "Information about ..." explanation
    doesn't adequately convey that.
    Examples:
    When calling storeEvents() with an iCalendar with a
    missing CR/LF between VEVENT components, that method
    returned the status "CAPI_STAT_DATA_ICAL".
    Some of the relevant status explanations include:
    CAPI_STAT_DATA_COOKIE = Information about the supplied cookie.
    CAPI_STAT_DATA_DATE = Information about a date.
    CAPI_STAT_DATA_EMAIL = Information about email.
    CAPI_STAT_DATA_ENCODING = Information about the encoding of supplied data.
    CAPI_STAT_DATA_HOSTNAME = Information about a hostname.
    CAPI_STAT_DATA_ICAL = Information about iCalendar data.
    CAPI_STAT_DATA_MIME = Information about MIME data.
    CAPI_STAT_DATA_UID = Information about a UID.
    CAPI_STAT_DATA_USERID = Information about a userID.
    In contrast, explanations like the following are much
    clearer:
    CAPI_STAT_DATA_USERID_FORMAT = The format of the UserId string was wrong.
    CAPI_STAT_DATA_USERID_ID = There was a problem with the Id part of the UserId string.
    Any improvements such as these in the status code
    explanations returned would be welcome, and might help
    save debugging time for those new to the CSDK.

    Thanks Aaron,
    Some notable improvements are coming in the next version of the Oracle Calendar application developer's guide, and your comments will be added for consideration.
    Best regards,
    Product Management

  • Need code explanation

    //I have the following code I am trying to understand, mainly how its calling the other classes. Any explanation would be great. Thanks Rick
    import javax.swing.*;
    import java.util.*;
    //I know this is the class after compiled...
    public class Assignment4Driver
         //I am trying to understant how this calling works
         public static void main(String[] args)
              ReadInput input2 = new ReadInput();
              int gradeCount = input2.readInput();
              GetGrade grade2 = new GetGrade();
              char grade = grade2.getGrade(gradeCount);     
              WriteOutput output2 = new WriteOutput();
              output2.writeOutput (gradeCount, grade);
    //ReadInput.java file
    public class ReadInput
         public int readInput()
              int gradeCount = 0;
              int counter = 0;
              while (counter < 5)
                   String gradeString = JOptionPane.showInputDialog("Enter grade from 0 to 20:");
                   gradeCount = gradeCount + Integer.parseInt(gradeString);
                   counter++;
              return gradeCount;
    //Get Grade.java file
    public class GetGrade
         public char getGrade(int gradeCount)
              char grade;
              if (gradeCount >= 90) grade = 'A';
              else if (gradeCount >= 80) grade = 'B';
              else if (gradeCount >= 70) grade = 'C';
              else if (gradeCount >= 60) grade = 'D';
              else grade = 'F';
              return grade;
    import javax.swing.*;
    import java.util.*;
    Here is the WriteOutput.java file
    public class WriteOutput
         public void writeOutput(int gradeCount, char grade)
              JOptionPane.showMessageDialog(null, "The total points awarded is " + gradeCount + ",\n"
                        + "which makes your final grade a " + grade);
    //Thanks a bunch.

    Basically I included four files and want to know about this.
    I think it looks like you are calling your class ReadInput, then it looks like you are assigning whatever value is there when you first call it to "input2", then you are saying that the "new" value is equivalent to input2 after the ReadInput file is read.
    ReadInput input2 = new ReadInput();
    after that you are saying the the variable gradeCount from the ReadInput file is equal to the input2.readInput, but I can't explain the input2.readInput below.
    int gradeCount = input2.readInput();
    portion of the code....
    I am not a big coder, and have been only working with one file at a time. I am trying to understand how you can have one class and call another class. I will study some more and see if I can post a question that makes more sense to you. I will see if I can access this site from work so I can keep looking at this thread.

  • Mechanism to return status code explanations?

    Does Oracle provide an mechanism in the SDK to return longer and presumably more end-user understandable explanations of SDK status codes, such as (for instance) "Logon authentication failed." when provided with the integer value of the status code whose string representation is 'CAPI_STAT_SECUR_LOGON_AUTH'?
    In other words, is an integral lookup table of this type already present in the SDK -- even if the explanations are currently provided only in the English language and perhaps even are not customizable -- or would we need to build our own?
    (This question could also be extended to apply to the status codes emitted by the Calendar Web Services ...)

    No, there is no corresponding message (English or otherwise) for the status codes in the Calendar SDK today.
    However you should be able to find descriptions of the status codes in the SDK documentation.
    Graham

  • Code explanation

    In a recent question the fix was:
    select 'update TABLE_NAME SET [' + name + '] = 0 where [' + name + '] is NULL'
    from sys.columns
    WHERE object_id = OBJECT_ID(N'[dbo].[TABLE_NAME]')
    The code worked great. I am trying to understand and learn more about exactly what is happening. Is there a link where I can go that will teach me what ['+name+'] is doing. I know that it is getting the information from the WHERE statement, but cannot
    figure out exactly how it works. I seem to learn and retain more when I understand what is happening, and not merely cutting and pasting some code that works.
    Your attention in this matter is greatly appreciated,
    Bruce

    You are building a dynamic string with the query. "name" is one of the columns in sys.columns
    select name from sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[TABLE_NAME]')
    If you have a string as one of your select fields then that exact string will be returned for every row in the result set.
    select 'is the column name' from sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[TABLE_NAME]')
    if you include a string along with columns you will get the column value(s) and the string will be repeated as as column in the result set.
    select name,'is the column names'
    from sys.columns
    WHERE object_id = OBJECT_ID(N'[dbo].[TABLE_NAME]')
    And finally, you can add columns together is they are compatible types. In this case the name column is compatible with the string.
    select name+' is the column name'from sys.columns WHERE object_id = OBJECT_ID(N'[dbo].[TABLE_NAME]')
    Here is a pretty comprehensive post abouts dynamic sql
    http://www.sommarskog.se/dynamic_sql.html

  • Flash Builder autogenerated service code explanation

    Hi
    When you connect to some backend via the Flash Builder "service inspector", it autogenerates alot of code, which seems to be giving you some additionel intellisense. I'm very interested in some documents that describe whats actually being autogenerated and for what reasons. Because when you don't use the service helper, you can connect to a backend in like 2-3 lines of code.
    Best Regards
    Martin Andersen

    Generally, the more specific you can be in programming the more efficient and less error prone the code is. The downside is that explicit declarations require much more typing.
    The auto generator attempts to generate code that is as specific as possible, and provides you some strongly typed methods to wrap the calls in. The VO objects probably look the most strange, but I think a lot of that is just explicit binding declarations. There is also some functionality added for advanced server setups (like lazy loading and such).

  • Math.atan2 Code Explanation Help

    Hello guys
    This is a piece of code from AS3 Making Things Move
    I tried to understand how this code works, but failed
    Please explain this code
    Thanks in advance

    There are two fetches to deal with the no records found situation.
    the basic idea is
    fetch
    while found loop
    ... do some processing ...
    fetch
    end loop
    If the first fetch doesn't result in a record the loop is not being executed,inside the loop the %notfound situation doesn't have to be trapped anymore.
    This is why the if inside the loop is redundant.
    Other than that this code is an example of slow by slow processing, introducing 3GL techniques, processing records, instead of SETS.
    The person responsible for this code ought to be fired.
    Sybrand Bakker
    Senior Oracle DBA

  • HotSpot source code explanation

    Hi!!
    I am new in this, so I will try to be as clear as I am able :)
    I need to modify the source code of the hotspot, and I do not find any information about the meaning of each file in the directory tree. I have tried to do it by myself, but it is a bit complicated for me ;P
    Any suggestion, WP, idea or anything about the meaning or the content of each file (as many as you can) will be of a huge help :D:D:D
    Thx!! :D:D:D:D

    Hi!!!
    I am doing a project about improving certains features in the JVM ;) so I need to modify the source code of the hotspot :)
    Thx!! :D

  • Java Graph code explanation

    Hi all,
    im new to java and have some trouble drawing a graph i looked up some code but dont quite understand it
    can someone explain the following code please. I understand swing and painting and basic java.
    Q1) Can please explain the flow of execution ?
    Q2)
    What i would also specifically like to understand about the code
    is how does the graph keep going and looks like it scrolls across and not off the frame and how can i add this to a frame i already have
    without covering over my other objects i have displayed.
    Any help would be greatly appreciated.
    Thanks
    import java.awt.*;*
    *import javax.swing.*;
    import java.awt.event.*;*
    *import javax.swing.event.*;
    import java.awt.image.BufferedImage;
    import java.awt.geom.*;*
    *import java.math.*;
    import java.util.*;*
    *public class ecg extends JFrame*
    *     myView view = new myView();*
    *     Vector vr   = new Vector();*
    *     int    ho   = 0;*
    *public ecg()* 
    *     addWindowListener(new WindowAdapter()*
        *{     public void windowClosing(WindowEvent ev)*
    *          {     dispose();*
    *               System.exit(0);}});*
    *     for (int i=0; i < 5000; i++)*
    *          int p = (int)(Math.random()*  260);
              vr.add(new Point(0,p-130));
         setBounds(3,10,625,350);
         view.setBounds(10,10,600,300);
         getContentPane().add(view);
         getContentPane().setLayout(null);
         setVisible(true);
         while (ho < 500-300)
              try
                   Thread.sleep(110);
                   ho = ho  +1;+
    +               repaint();+
    +          } catch (InterruptedException e) {}+
    +     }+
    +}+
    +public class myView extends JPanel+
    +{+
    +     BufferedImage I;+
    +     Graphics2D    G;+
    +public myView()+
    +{+ 
    +}+
    +public void paint(Graphics g)+
    +{+
    +     if (I == null)+
    +     {+
    +          I = new BufferedImage(getWidth(),getHeight(),BufferedImage.TYPE_INT_ARGB);+
    +          G = I.createGraphics();+
    +     }+
    +     G.setColor(Color.white);+
    +     G.fillRect(0,0,getWidth(),getHeight());+
    +     G.setColor(Color.gray);+
    +     Point p1,p2;+
    +     p1 = (Point)vr.get(ho);+
    +     int x = 0;+
    +     for (int y=1; y < 600; y++)
              p2 = (Point)vr.get(y+ho);
              G.drawLine(x,p1.y+150,x+6,p2.y+150);
              p1 = (Point)vr.get(y+ho);
              x = x + 6;
         g.drawImage(I,0,0,null);
    public static void main (String[] args) 
         new ecg();
    }

    Compiling your posted code gives a compiler warning:
    C:\jexp>javac ecg.java
    Note: ecg.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    C:\jexp>javac -Xlint:unchecked ecg.java
    ecg.java:31: warning: [unchecked] unchecked call to add(E) as a member of the raw type jav
    a.util.Vector
                vr.add(new Point(0,p-130));
                      ^
    1 warningWe can eliminate this by changing this
        Vector vr   = new Vector();to this
        Vector<Point> vr   = new Vector<Point>();The best way to understand things like this is to start a new file and slowly build it up so you can see what's going on, step-by-step. I've put in some comments and print statements to give you a start.
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.awt.image.BufferedImage;
    import java.awt.geom.*;
    import java.math.*;
    import java.util.*;
    public class ECG extends JFrame
        myView view = new myView();
        Vector<Point> vr = new Vector<Point>();
        int    ho   = 0;
        public ECG()
            addWindowListener(new WindowAdapter()
                @Override
                public void windowClosing(WindowEvent ev)
                    dispose();
                    System.exit(0);
            // Initialize data in Vector.
            for (int i=0; i < 5000; i++)
                int p = (int)(Math.random() * 260); // range: (0    - 260]
                vr.add(new Point(0, p-130));        // range: (-130 - 130]
            System.out.println("Total number of data points: " + vr.size());
            setBounds(3,10,625,350);
            // Component drawing space is 600 wide by 300 high.
            view.setBounds(10,10,600,300);
            getContentPane().add(view);
            getContentPane().setLayout(null);
            setVisible(true);
            // Animate up thru the first 200 of 5000 data points.
            int millisPerSecond = 1000;
            long delay = 110;
            long framesPerSecond = millisPerSecond/delay;
            System.out.printf("Frames per second: %d%n", framesPerSecond);
            int paintSteps = 600;
            int dataIndex = 200;
                            //5000 -1 - paintSteps;  // max possible index
            System.out.printf("Expected animation time: %f seconds%n",
                               (double)dataIndex/framesPerSecond);
            long start = System.currentTimeMillis();
            // Animation loop.
            while (ho < dataIndex)
                try
                    Thread.sleep(delay);
                    // Increment "ho" which will step us through the Vector data.
                    // Each new value draws the Vector graph data starting at
                    // index "ho" placed at the left edge of the image/component.
                    ho = ho + 1;
                    long end = System.currentTimeMillis();
                    double elapsedTime = (double)(end - start)/millisPerSecond;
                    if(ho % 100 == 0)
                        System.out.printf("ho: %d  time: %.2f%n", ho, elapsedTime);
                    // Update the image in the paint method.
                    repaint();
                } catch (InterruptedException e) {
                    System.out.println("animation interrupted");
            long end = System.currentTimeMillis();
            double elapsedTime = (double)(end - start)/millisPerSecond;
            System.out.printf("Total animation loop time: %f%n", elapsedTime);
        public class myView extends JPanel
            BufferedImage I;
            Graphics2D    G;
            public void paint(Graphics g)
                if (I == null)  // initializw image
                    I = new BufferedImage(getWidth(),getHeight(),
                                          BufferedImage.TYPE_INT_ARGB);
                    G = I.createGraphics();
                // Update image to show current state of animating graph.
                // Fill Background color.
                G.setColor(Color.white);
                G.fillRect(0,0,getWidth(),getHeight());
                // Set graph line color.
                G.setColor(Color.gray);
                // Draw next data segment to newly-erased image.
                // Get two points in data to draw the next line.
                Point p1,p2;
                // "ho" is a simple counter with range [0 - n-1]
                // [0 - 200-1] in the animation loop above.
                // Get the next data point at "ho" which will be drawn at
                // the beginning, ie, left edge (x = 0), of the image.
                p1 = vr.get(ho);
                int x = 0;
                // Since each frame starts at zero_x relative to the image:
                // x = 0.
                // Draw all graph data for this one 600 by 300 image frame
                // with data beginning at index "ho".
                for (int y=1; y < 600; y++)
                    // Get the next point out ahead.
                    p2 = vr.get(y+ho);
                    // Draw a line from the last point, p1, to the next point, p2,
                    // which will be spaced (x +=) 6 apart along the image/component
                    // width of 600 (setBounds). Translate the y values down onto
                    // the component by 150 pixels (the range of y values from
                    // above is from -129 to 130). The "+150" shifts the y values
                    // to the approximate center of the component.
                    G.drawLine(x, p1.y+150, x+6, p2.y+150);
                    // Save the current point to/in p1 for the next iteration.
                    p1 = vr.get(y+ho);
                    // Move along to the right in the image.
                    x = x + 6;
                // Draw image in component.
                g.drawImage(I,0,0,null);
        public static void main (String[] args)
            new ECG();
    }

  • Some code explanation.

    dear all,
    can u please tell me what does     month = SOURCE_FIELDS-fiscper+5(2). does? what exactly does +5(2) does? thanks.

    Offset
    month = SOURCE_FIELDS-fiscper+5(2).
    the above code will populate the month from the  SOURCE_FIELD field fiscper
    fiscper+5(2)
    +5 "from 5th position(character 6 and character 7) , 2 means 2 characters(char 6, char 7)
    will be taken .
    Read the help on Offest.

  • Java Code explanation

    Iam new in java and on going learning, iam puzzle with this code, based on this code why the value x1 change when value x2 is set to different time? please do explain to me.. TQ
    class MyTime {
         public static void main(String[] args) {
              Time x1, x2;
              x1 = new Time();
              x1.setTime(1, 00);
              x2=x1;
              System.out.print("x1: ");
              x1.whatTime();
              System.out.println();
              System.out.print("x2: ");
              x2.whatTime();
              System.out.println();
              x2.setTime(3, 00);
              System.out.print("x1: ");
              x1.whatTime();
              System.out.println();
              System.out.print("x2: ");
              x2.whatTime();
              System.out.println();
    }

    What you have to realiuse is that x1 and x2 are not Time objects. They are just pointers that point to the same Time object. So for example say you have two people called x1 and x2 standing and pointing at stuff written on a blackboard, the same blackboard. So if you get person x1 to make any changes to what is written on the blackboard, person x2 is still pointing to the same stuff on that same blackboard.

  • Code explanation help

    Declare
    CURSOR curEMP is
         Select Empno,Fname,Lname,Sal From Emp;
    varEmpno Emp.Empno%type;
    varFname Emp.Fname%type;
    varLname Emp.Lname%type;
    varSal   Emp.Sal%type;
    varUname Emp.Uname%type;
    varpwd   Emp.pwd%type;
    Begin
    Open curEMP;
    If curEmp%ISOPEN Then
    Fetch curEMP
      INTO varEmp,varfname,varLname,varSal;
    While curEMP%FOUND
    LOOP
      Exit When curEMp%NOTFOUND;
      IF curEMp%FOUND THEN
      varUname:=SUBSTR(varFname,-2,2);
      varPwd:=Substr(varLname,2,2);
    Update EMP set  Uname=varUname,pwd=varPwd where Empno=varempno;
    Fetch curEMP INTO varEMpNo,varFname,varLname,varSal;
    End IF;
    End Loop;
    commit;
    Else
    Dbms_Output.Put_line('No recd found');
    End IF;
    Close curEmp;
    End;
    Could you help me why do "fetch statements" in this code used  twice.
    Thanks & Regard
    pallis                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    There are two fetches to deal with the no records found situation.
    the basic idea is
    fetch
    while found loop
    ... do some processing ...
    fetch
    end loop
    If the first fetch doesn't result in a record the loop is not being executed,inside the loop the %notfound situation doesn't have to be trapped anymore.
    This is why the if inside the loop is redundant.
    Other than that this code is an example of slow by slow processing, introducing 3GL techniques, processing records, instead of SETS.
    The person responsible for this code ought to be fired.
    Sybrand Bakker
    Senior Oracle DBA

  • Code explanation sort

    Dear Everyone,
    I am using some really neat code to listen to a group of JComboBoxes.
    The four JComboBoxes in question sit on a JFrame and each of the boxes presents the program user with ten numberical choices, namely 0-9.
    The Listener method for one of the JComboBoxes, named Millennia is shown below:
    Millennia.addItemListener(new ItemListener(){
    public void itemStateChanged(ItemEvent e){
    Millenniaxx = Millennia.getSelectedIndex();
    If anybody can explain to me what the above code does it would be greatly appreciated.
    Thanks

    This code adds a listener to listen to a seelction of an item in the JComboBox, when a selection is made the int Millenniaxx will be equal to the number of the selected item.
    Noah

  • How to create TAX CODE, explanation of TAx %..

    Hi guru's
    Can anybody explain me , How to create a TAX code(fv11) for below mentioned structure.
    16%2%1%VAT 8%DEDUCTIBLE4.5%NON DEDUCTIBLE
    .please explain me the 16% stands for what , 2%for what,1% for what…etc
    For which type of vendor , and material I want to use this tax code.. and explain what is deductible & non deductible..
    URGENt..
    Thanks
    vicky..

    in your tax procedure taxinn
    u must have condution tyoe for bed esec higher edcess vat deductable and nondeductable
    JMOP     IN: BED setoff %
    JEC1     IN Ed Cess Setoff
    JSEP     IN:A/P SECess setoff
    JVRD     IN VAT Raw Deduc
    JVRN     IN VAT Raw Non Deduc
    maintain tax persentage in tahat fv11 for that above condition type
    JMOP     IN: BED setoff %     16
    JEC1     IN Ed Cess Setoff    2
    JSEP     IN:A/P SECess setoff  1
    JVRD     IN VAT Raw Deduc      8
    JVRN     IN VAT Raw Non Deduc  4.5
    Deductable means u will get set off against this ie this value will not be added to material cost
    and nondeductabe meean that this cost will add to material; cost
    go to FV11 put cond type say JMOP
    enter
    click on plant vendor and material
    put plant vendor material number and put persantage 16
    in same way do for others
    hope issue is solved
    reward accordingly
    Message was edited by:
            Umakant Bhangale

  • Help with code explanation

    Help explaining this section of the code, mainly the loop part. A pseudo code explaination would be greatful. What I confuses me is how the two consective loops work? Let say if the first loop on line 260 is terminated then what?{color:#808080}
    239 public static class RandomIvValidator {
    240 private long m_rand = 0;
    241 public char next() {
    242 m_rand = (m_rand * 1103515245) + 24691;
    243 return (char)(m_rand >>> 16);
    244 }
    245 /** This function takes the random number generator back a step.
    246 *
    247 */
    248 public char prev() {
    249 m_rand = (m_rand * 4005161829L) + 171270561;
    250 return (char)(m_rand >>> 16);
    251 }{color}
    {color:#808080} 252 public boolean isLegal(int[] ivs, AnimalNature nature, boolean dp) {
    253 int internal = nature.getInternalValue();
    254 long num1 = (ivs[Char.S_DEFENCE] << 10)
    255 + (ivs[Char.S_ATTACK] << 5)
    256 + ivs[Char.S_HP];
    257 long num2 = (ivs[Char.S_SPDEFENCE] << 10)
    258 + (ivs[Char.S_SPATTACK] << 5)
    259 + ivs[Char.S_SPEED];
    {color}{color:#ff0000} 260 for (int i = 0; i < 2; ++i) {
    261 for (int j = 0; j < 65536; ++j) {
    262 m_rand = (i << 31) + (num1 << 16) + j;
    {color} {color:#808080}263 long first = m_rand;
    264 long second = next();
    265 if (second >= 32768) {
    266 second -= 32768;
    267 }{color}
    Edited by: Bakery on May 15, 2008 5:23 AM

    They're not consecutive, because that means "one after another". These loops are nested. If the outer loop, which starts on 260, were to be broken, it would proceed to the next line after the loop's closing brace, which is not shown in this snippet.
    I'm not even going to bother trying to pseudo-code this, because it's written at such a low level that all the high-level semantic information is lost, other than what's provided in the comments. It looks like C code that was directly ported to Java.
    for(...) { //outer loop runs n times
       outer loop statements //I am executed n times
       for(...) { //inner loop runs m times
          inner loop statements //I am executed n * m times
    }Edited by: nclow on May 15, 2008 1:20 PM

Maybe you are looking for

  • Push notifications and GPS not working on wifi - please help

    Hi, I have an iPhone 4 with at&t (US) and latest iOS. but I am outside the US for a month and I have put the phone in airplane mode so that I don't receive phone calls or texts (I can choose not to answer phone calls but apparently I will receive the

  • I have Mac OSX 10.7.5. How can i upgrade to 10.9?

    I have Mac OSX 10.7.5. How can i upgrade to 10.9 as all teh new apps require new OS?

  • Problem with BAPI_DOCUMENT_CREATE2

    HI, I am creating document using  FM BAPI_DOCUMENT_CREATE2. In IDES, i am able to create with new status. But i am getting an error message as 'The status set requires a previous status'. What could be the problem? is it due to the additional pacthes

  • WebDav Very Slow on Windows 7 Pro

    Environment: Hosted SharePoint 2010 Two laptops on a Windows Domain: 1) Windows 7 Pro 32-bit & IE11 and 2) Windows 7 Pro 64-bit & IE11. Problem: WebDAV is VERY slow on Windows 7 only. When using WebDAV on Windows 8 or using the web portal (browser), 

  • Hello with 3Gs and Ios6, i can't use the numeric Keyboard

    Hello, I have doing the Update Ios6 of my 3 Gs, and i can't use the keyboard numeric. I can't use the 'Q' with the keybord Qwerty, and i Can't use the 'A' with Azerty. If i install the Icones Imoji, i can't use the other keyboard. I can't del a keybo