我从我们的 Hyperion 规划系统中导出了所有的网络表单,我正在尝试建立一个数据库,列出每个网络表单的关键细节。网络表单导出为 XML,如下所示:
<?xml version="1.0" encoding="UTF-8" ?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="6.4 AC Planning" dir="Forms/PnL Inputs" enableOffline="false" planType="2" hide="false" enableCubeView="false" readOnly="false" >
<instruction>Use this form to view detailed account information, and input base level adjustments.</instruction>
<query>
<columns width="100" >
<segment>
<dimension displayName="true" displayAlias="false" displayMemberFormula="false" displayConsolidationOperators="false" name="Period" hide="false" expand="true" >
<function include="true" name="Descendants" >
<member name="YearTotal" />
</function>
</dimension>
</segment>
</columns>
<rows height="22" >
<segment readOnly="true" >
<dimension displayName="false" displayAlias="true" displayMemberFormula="false" displayConsolidationOperators="false" name="Account" hide="false" expand="true" >
<member name="Advertising - % of Net Revenue SP" />
</dimension>
</segment>
<segment showSeparator="true" >
<dimension displayName="false" displayAlias="true" displayMemberFormula="false" displayConsolidationOperators="false" name="Account" hide="false" expand="true" >
<member name="PL214040" />
<member name="PL214096" />
<member name="PL214011_01" />
<member name="PL214011_03" />
<member name="PL214011_02" />
</dimension>
</segment>
<segment>
<dimension displayName="false" displayAlias="true" displayMemberFormula="false" displayConsolidationOperators="false" name="Account" hide="false" expand="true" >
<member name="PL214021_01" />
<member name="PL214021_03" />
<member name="PL214021_02" />
<member name="PL214020" />
</dimension>
</segment>
</rows>
<pages>
<segment>
<dimension displayName="false" displayAlias="true" displayMemberFormula="false" displayConsolidationOperators="false" name="Entity" hide="false" >
<function include="true" name="Descendants" >
<member name="&Root_Entity" />
</function>
</dimension>
<dimension displayName="false" displayAlias="true" displayMemberFormula="false" displayConsolidationOperators="false" name="Product" hide="false" >
<function include="true" name="Descendants" >
<member name="&Root_Product" />
</function>
</dimension>
<dimension displayName="false" displayAlias="true" displayMemberFormula="false" displayConsolidationOperators="false" name="Channel" hide="false" >
<member name="CH02" />
<member name="CH03" />
</dimension>
<dimension displayName="false" displayAlias="false" displayMemberFormula="false" displayConsolidationOperators="false" name="Scenario" hide="false" >
<function name="Descendants" >
<member name="Planning Scenarios" />
</function>
</dimension>
<dimension displayName="false" displayAlias="false" displayMemberFormula="false" displayConsolidationOperators="false" name="Version" hide="false" >
<function name="Descendants" >
<member name="Planning Versions" />
</function>
</dimension>
<dimension displayName="false" displayAlias="false" displayMemberFormula="false" displayConsolidationOperators="false" name="Year" hide="false" >
<member name="&CurrFormYear1" />
<member name="&CurrFormYear2" />
</dimension>
<dimension displayName="false" displayAlias="false" displayMemberFormula="false" displayConsolidationOperators="false" name="Currency" hide="false" >
<member name="LCL" />
<member name="LCL (000s)" />
</dimension>
</segment>
</pages>
<pov>
<dimension displayName="false" displayAlias="false" displayMemberFormula="false" displayConsolidationOperators="false" name="EVA" hide="false" >
<member name="No_EVA" visible="true" />
</dimension>
<dimension displayName="false" displayAlias="false" displayMemberFormula="false" displayConsolidationOperators="false" name="ICP" hide="false" >
<member name="ZERO_ICP" visible="true" />
</dimension>
<dimension displayName="false" displayAlias="false" displayMemberFormula="false" displayConsolidationOperators="false" name="RptLevel" hide="false" >
<member name="RL0045" visible="true" />
</dimension>
</pov>
</query>
<businessRules>
<businessRule calcType="0" name="AandC_Base" planType="2" runOnSave="true" hidePrompt="true" useMRU="true" />
</businessRules>
<displayOptions>
<precision useCurrencyPrecision="false" nonCurrencyMax="0" nonCurrencyMin="0" currencyMax="2" percentageMax="2" currencyMin="0" percentageMin="0" />
<display poundMissing="true" enableAttributeDisplay="false" enableCellAttach="true" enableAdHoc="false" multiCurrency="false" enableMassAllocation="false" accountAnnotation="false" enableGridSpread="true" />
<printOptions>
<pageSettings pageSize="A4" orientation="0" font="" fontSize="8" rowHeaderPercentage="35" numDataCols="10" />
<format supportingDetails="false" applyPrecision="false" repeatHeaders="true" formatData="true" />
<printDisplay currency="true" shading="true" cellNotes="false" attribute="true" accountAnnotation="true" />
</printOptions>
<smartViewOptions enableForSmartSlice="false" enableOfflineUsage="false" />
</displayOptions>
<dataValidationRules>
<dataValidationRulesOptions>
<RunValidationsAsLoggedInUser>false</RunValidationsAsLoggedInUser>
<ValidateOnlyForPagesWithBlocks>false</ValidateOnlyForPagesWithBlocks>
<ValidateOnlyForUsersWithAccessToForm>false</ValidateOnlyForUsersWithAccessToForm>
</dataValidationRulesOptions>
</dataValidationRules>
</form>
因此,我希望从以下内容中进行构建:
Dimension | Location | Display name | Display alias | Members
______________________________________________________________________
Account | Row | False | True | PL214040; PL214096; PL214011_01; etc
Period | Column | True | False | Descendants(YearTotal)
我正在使用 vbscript 并尝试使用 RegEx 搜索来解决它,但是虽然它们在大多数细节上都可以正常工作,但对于成员列表。
那是我切换到 XMLDOM 的时候,但我无法继续使用它。我在这里研究了很多,找到了很多好材料,但我无法采用它们来提取上面的内容。
请记住,有些表单将在列中有帐户,有些在 pov 中,等等。我有一个可能维度的列表,所以我知道要查找什么,但其他一切都与一个 XML 不同。
任何帮助将非常感激!
稍后:基于一些评论(谢谢!)和一些更烦躁的 XMLDOM,我终于能够检索出我想要的最终结果的前 3 列,现在我“只有”很难全部每个维度包含的成员。
下面是代码,我希望这能进一步阐明我的查询,并且有人将能够帮助您了解如何收集成员以及每个维度使用函数的位置。
Set xmlDoc=CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("c:\Users\maxlamer\Documents\6.4 AC Planning.xml")
arrMyDimensions=Array("Account","Period","Currency/Value","Year","Entity","Scenario","ICP","Channel","Version","RptLevel","EVA","Product")
Set nodes = xmlDoc.selectNodes("//*")
For i = 0 to nodes.length - 1
bolFoundOne = False
m=0
For n=LBound(arrMyDimensions) to UBound(arrMyDimensions)
If nodes(i).getAttribute("name")=arrMyDimensions(n) Then
bolFoundOne = True
m=n
End if
Next
If bolFoundOne Then
If nodes(i).parentNode.nodeName="pov" Then
WScript.Echo arrMyDimensions(m) & " is in:" & nodes(i).parentNode.nodeName
Else
WScript.Echo arrMyDimensions(m) & " is in:" & nodes(i).parentNode.parentNode.nodeName
End if
Set pn_attribs = nodes(i).attributes
strMyTempString = arrMyDimensions(m) & " attributes :"
For Each pnAttr in pn_attribs
strMyTempString = strMyTempString & pnAttr.name & " = " & pnAttr.value & vbTab
Next
WScript.Echo strMyTempString & vbCrlf
arrMyDimensions(m)="XX_Located_XX"
End if
Next
我知道以上内容相当粗略,我仍然需要构建一个适当的包装器以使输出格式良好,但应该让您对我正在驱动的内容有一个很好的了解。现在我只需要最后一列。