QlikView。 条件格式“类似于Excel”

任务是使表的条件格式“像在Excel中一样”。 QlikView完全有能力应付按条件进行着色的标准任务,但是可以动态选择参数,甚至像在Excel中一样,问题也浮出水面:“是不是真的呢?”。
底线:有多个实现选项,多个版本,在测试和调试上花费了大量时间。 重构完成的实施程序。 我提供了最终版本,可以满足客户的需求,经过测试和验证。

功能性任务(陈述)


有一个表格,其中动态选择维和表达式,用于计算值本身的公式很简单:总和,平均值,相对百分比,绝对值等。

需要使用户能够根据所选参数为表格着色。 关键介绍-一列应能够根据不同的参数以不同的颜色绘制,即多色。 第二个关键应该是能够根据另一个“相互关联的参数”对字段进行着色的能力,例如,我们根据“市场上产品的平均价格”的值来对“购买量”进行着色。
以下是实现的主要部分。 我将不讨论隐藏/关闭菜单,创建列表等内容。 如果您对细节有疑问,我会另外告诉您。

最终的结果是棘手的:



块1.功能菜单的数据准备


该代码为第3块中描述的菜单列表奠定了基础。
tColorsFormatListSelection: LOAD * INLINE [%ColorDisplayNameFormat      n   n%  n   n%     ]; tFilterTypeListSelection: LOAD * INLINE [%FilterDisplayNameType    ]; tColorsTableList: LOAD*INLINE [%ColorDisplayName|%ColorRGBValue|%SortColorList -| RGB(192,0,0)|1 | RGB(255,0,0)|2 | RGB(255,192,0)|3 | RGB(255,255,0)|4 -| RGB(146,208,80)|5 | RGB(0,176,80)|6 -| RGB(0,176,240)|7 | RGB(0,112,192)|8 -| RGB(0,32,96)|9 | RGB(112,48,160)|10 ](delimiter is '|'); tColorFieldsListSelectionRelation: Load [ Qlik] AS %ColorFieldName, [/] AS %ExpressionType D:\QLIK\Data\Mapped_fields.xlsx (ooxml, embedded labels, table is [MetaField]) WHERE Match([/],'',''); tColorFieldsListSelectionClause: Load [ Qlik] AS %ColorFieldNameClause, [/] AS %ExpressionTypeClause FROM D:\QLIK\Data\Mapped_fields.xlsx (ooxml, embedded labels, table is [MetaField]) WHERE Match([/],''); 


我还需要创建几十个变量:



vColorFormatString-收集的字符串

vColorFormatString1 ... 10-旨在将vColorFormatString的字符串解析为10个绝对值参数,我有意进行了此限制,我的观点是不再需要此限制,通常,此限制纯粹是意识形态上的,您可以花一点时间来增加参数的数量。

vColorFormatStringPerc1 ... 10-旨在将vColorFormatString中的字符串解析为10个相对值的参数(百分比)

vColorFormat1 ... 10-颜色

块2.功能菜单的开发1




预约:

  1. 显示用户创建的参数的当前列表。
  2. 能够删除任何条件格式设置选项
  3. 调用菜单以选择条件格式设置选项。

让我们关注以下两个要素。

第一个是显示当前创建的参数。

该区域是文本对象,这些文本对象基于解析字符串显示当前创建的参数。 现在,这是整个动作的第一步:

文字显示公式
 = SubField(TextBetween(vColorFormatString,'||','||',1),'|',1) & '' & If(SubField(TextBetween(vColorFormatString,'||','||',1),'|',1) = SubField(TextBetween(vColorFormatString,'||','||',1),'|',2),'', SubField(TextBetween(vColorFormatString,'||','||',1),'|',2)) & ' ('& SubField(TextBetween(vColorFormatString,'||','||',1),'|',4) & ' '& If( Index(SubField(TextBetween(vColorFormatString,'||','||',1),'|',2),'%')>0 OR Index(SubField(TextBetween(vColorFormatString,'||','||',1),'|',4),'%')>0, If(WildMatch( SubField(TextBetween(vColorFormatString,'||','||',1),'|',4),'**'),'', num($(=SubField(TextBetween(vColorFormatString,'||','||',1),'|',5)),'# ##0,00')) & ' % '& If(WildMatch( SubField(TextBetween(vColorFormatString,'||','||',1),'|',6),'*Empty*'),'', num($(=SubField(TextBetween(vColorFormatString,'||','||',1),'|',6)),'# ##0,00')&' %') , If(WildMatch( SubField(TextBetween(vColorFormatString,'||','||',1),'|',4),'**'),'', num($(=SubField(TextBetween(vColorFormatString,'||','||',1),'|',5)),'# ##0.0')) & ' '& If(WildMatch( SubField(TextBetween(vColorFormatString,'||','||',1),'|',6),'*Empty*'),SubField(%EdName,',',1), num($(=SubField(TextBetween(vColorFormatString,'||','||',1),'|',6)),'# ##0.0')& ' ' &SubField(%EdName,',',1) ) )& ')' 


有些恐怖吧?

现在,我认为许多人都清楚所有逻辑都是在文本行上实现的。 收集了一行-整理了一行!

弦组件具有以下形式

|| RWA%| RWA%| RGB(255,0,0)|高于平均值| num(vColorFormatValue1 / 100,'### 0,00')|空
|| CODE%| CODE%| RGB(255,0,0)|低于平均值| num(vColorFormatValue1 / 100,'### 0,00')|空
|| GCD%| GCD%| RGB(255,0,0)|低于平均值| num(vColorFormatValue1 / 100,'### 0,00')|空
|| RORWA%| RORWA%| RGB(255,0,0)|低于平均值|舍入(数字(124.63),0.0001)|空
|| EL%| EL%| RGB(255,255,0)|高于平均值|舍入(数字(124.62),0.0001)|空
|| EL%| EL%| RGB(0,176,80)|低于平均值|舍入(数字(124.62),0.0001)|空
|| OD%| OD%| RGB(0,112,192)|低于平均值|舍入(数字(124.62),0.0001)|空
||

让我们来分析一下

|| WhatColor | 什么价值 颜色 条件 | 值1 | 值2

SubField部分中的索引(TextBetween(vColorFormatString,'||','||',1),'|',4)-每个参数的表达式都以'||'突出显示 '||',用单个'|'分隔的属性表达式 因此,索引1和4表示取参数的第一块,并从中取第四值。

“ between”参数之间的两个值(Value1,Value2)。

让我们更进一步...

删除参数本质上是字符串中值的“重播”。

删除条件格式参数的代码
=Replace(vColorFormatString, '||' & TextBetween(vColorFormatString,'||','||',1),'')

块3.功能菜单的开发2


图片1


图片2


图片3


收集参数的主菜单。 再说一遍,我不会详细介绍列表的元素以及它们用于隐藏闭包的逻辑的描述。

该行的主要逻辑是收集用户在此菜单中提示的所有缝制到“就绪”按钮的内容。

操作“设置变量”是vColorFormatString,代码:
 =If( SubStringCount(vColorFormatString,'||')<11 AND ( (vColorParamByClause=0 AND ( (Len(GetFieldSelections(%ColorFieldName))>0 AND Len(GetFieldSelections(%ColorFieldNameClause))>0) AND (GetFieldSelections(%ColorFieldName) <> GetFieldSelections(%ColorFieldNameClause)) )) OR (vColorParamByClause=1 AND Len(GetFieldSelections(%ColorFieldNameClause))>0) ), If(vColorParamByClause=0, if(len(vColorFormatString)<1, '||' & Trim(GetFieldSelections(%ColorFieldName,'|',50)) &'|' & Trim(GetFieldSelections(%ColorFieldNameClause,'|',50)) &'|' & $(=only({<%ColorDisplayName={"$(=SubField(concat(%ColorDisplayName,',',%SortColorList),',',1))"}>}%ColorRGBValue)) &'|'& GetFieldSelections(%ColorDisplayNameFormat,'|',1) & '|'& vColorFormatValue1Transform & '|'& If(GetFieldSelections(%ColorDisplayNameFormat,1) ='', vColorFormatValue2Transform,'Empty') & '||', vColorFormatString & Trim(GetFieldSelections(%ColorFieldName,'|',50)) &'|' & Trim(GetFieldSelections(%ColorFieldNameClause,'|',50)) &'|' & $(=only({<%ColorDisplayName={"$(=SubField(concat(%ColorDisplayName,',',%SortColorList),',',1))"}>}%ColorRGBValue)) &'|'& GetFieldSelections(%ColorDisplayNameFormat,'|',1) & '|'& vColorFormatValue1Transform & '|'& If(GetFieldSelections(%ColorDisplayNameFormat,1) ='', vColorFormatValue2Transform,'Empty') &'||' ) , if(len(vColorFormatString)<1, '||' & Trim(GetFieldSelections(%ColorFieldNameClause,'|',50)) &'|' & Trim(GetFieldSelections(%ColorFieldNameClause,'|',50)) &'|' & $(=only({<%ColorDisplayName={"$(=SubField(concat(%ColorDisplayName,',',%SortColorList),',',1))"}>}%ColorRGBValue)) &'|'& GetFieldSelections(%ColorDisplayNameFormat,'|',1) & '|'& vColorFormatValue1Transform & '|'& If(GetFieldSelections(%ColorDisplayNameFormat,1) ='', vColorFormatValue2Transform,'Empty') & '||', vColorFormatString & Trim(GetFieldSelections(%ColorFieldNameClause,'|',50))&'|' & Trim(GetFieldSelections(%ColorFieldNameClause,'|',50)) &'|' & $(=only({<%ColorDisplayName={"$(=SubField(concat(%ColorDisplayName,',',%SortColorList),',',1))"}>}%ColorRGBValue)) &'|'& GetFieldSelections(%ColorDisplayNameFormat,'|',1) & '|'& vColorFormatValue1Transform & '|'& If(GetFieldSelections(%ColorDisplayNameFormat,1) ='', vColorFormatValue2Transform,'Empty') &'||' ) ), vColorFormatString ) 


块5.解析文本


变量的代码是vColorFormatString1 ... 10。

10个变量中每个变量的关键点是更改SubField SubField的索引(TextBetween(vColorFormatString,'||','||', 1 )-vColorFormatString 1的索引1。

对于vColorFormatString 4-分别
子字段(TextBetween(vColorFormatString,'||','||', 4

绝对值解析变量代码
 =If(Len(SubField(TextBetween(vColorFormatString,'||','||',4),'|',4))>0, Pick(Match(SubField(TextBetween(vColorFormatString,'||','||',4),'|',4) ,'','','','',' n ',' n%',' n ',' n%',' ',' '), // 'round(sum(['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &'])/$(=%Value),1)' & '>' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',4),'&chr(39)&'|'&chr(39)&',5)'), // 'round(sum(['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &'])/$(=%Value),1)' & '<' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',4),'&chr(39)&'|'&chr(39)&',5)'), // 'round(sum(['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &'])/$(=%Value),1)' & '>' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',4),'&chr(39)&'|'&chr(39)&',5)') &' AND '& 'round(sum(['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &'])/$(=%Value),1)' & '<' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',4),'&chr(39)&'|'&chr(39)&',6)'), // 'round(sum(DISTINCT ['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &'])/$(=%Value),1)' & '=' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',4),'&chr(39)&'|'&chr(39)&',5)'), // n  'num(rank(if(round(sum(['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &'])/$(=%Value),1)>0, sum(['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &']))/$(=%Value),1))' & '<=' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',4),'&chr(39)&'|'&chr(39)&',5)'), // n% '100-((sum(['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &']) / SUM( TOTAL ['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &']))*100) < ' & '100-' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',4),'&chr(39)&'|'&chr(39)&',5)') , // n  'num(rank(if(round(sum(['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &'])/$(=%Value),1)>0, -sum(['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &']))/$(=%Value),1))' & '<=' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',4),'&chr(39)&'|'&chr(39)&',5)'), // n% '((sum(['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &']) / SUM( TOTAL ['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &']))*100) < ' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',4),'&chr(39)&'|'&chr(39)&',5)'), //  'sum(DISTINCT ['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &'])>= Median(TOTAL <$(vGroupByList)> ['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &'])', //  'sum(DISTINCT ['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &'])<= Median(TOTAL <$(vGroupByList)> ['& Trim(SubField(TextBetween(vColorFormatString,'||','||',4),'|',2)) &'])' ),'0>1') 


出于兴趣,内容比较复杂
 =If(Len(SubField(TextBetween(vColorFormatString,'||','||',2),'|',4))>0 AND $(='WildMatch('& chr(39) & SubField(TextBetween(vColorFormatString,'||','||',2),'|',2)&chr(39) & ',' &chr(39)&'EL %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &','& chr(39)&'RWA %'&chr(39) &','& chr(39)&'RWA%(RORWA)'&chr(39) &','& chr(39)&'RORWA%'&chr(39) &')')>0, Pick(Match(SubField(TextBetween(vColorFormatString,'||','||',2),'|',4) ,'','','','',' n ',' n%',' n ',' n%',' ',' '), // Pick($(='WildMatch('& chr(39) & SubField(TextBetween(vColorFormatString,'||','||',2),'|',2)&chr(39) & ',' &chr(39)&'EL %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &','& chr(39)&'RWA %'&chr(39) &','& chr(39)&'RWA%(RORWA)'&chr(39) &','& chr(39)&'RORWA%'&chr(39) &')'), '$(vELPercFormula)','$(vNODPercFormula)','$(vODPercFormula)','$(vKODPercFormula)','$(vRWAPercFormula)','$(vRWAPercRORWAFormula)','$(vRORWAPercFormula)') & '>' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',2),'&chr(39)&'|'&chr(39)&',5)'), // Pick($(='WildMatch('& chr(39) & SubField(TextBetween(vColorFormatString,'||','||',2),'|',2)&chr(39) & ',' &chr(39)&'EL %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &','& chr(39)&'RWA %'&chr(39) &','& chr(39)&'RWA%(RORWA)'&chr(39) &','& chr(39)&'RORWA%'&chr(39) &')'), '$(vELPercFormula)','$(vNODPercFormula)','$(vODPercFormula)','$(vKODPercFormula)','$(vRWAPercFormula)','$(vRWAPercRORWAFormula)','$(vRORWAPercFormula)') & '<' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',2),'&chr(39)&'|'&chr(39)&',5)'), // Pick($(='WildMatch('& chr(39) & SubField(TextBetween(vColorFormatString,'||','||',2),'|',2)&chr(39) & ',' &chr(39)&'EL %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &','& chr(39)&'RWA %'&chr(39) &','& chr(39)&'RWA%(RORWA)'&chr(39) &','& chr(39)&'RORWA%'&chr(39) &')'), '$(vELPercFormula)','$(vNODPercFormula)','$(vODPercFormula)','$(vKODPercFormula)','$(vRWAPercFormula)','$(vRWAPercRORWAFormula)','$(vRORWAPercFormula)') & '>' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',2),'&chr(39)&'|'&chr(39)&',5)') &' AND '& Pick($(='WildMatch('& chr(39) & SubField(TextBetween(vColorFormatString,'||','||',2),'|',2)&chr(39) & ',' &chr(39)&'EL %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &','& chr(39)&'RWA %'&chr(39) &','& chr(39)&'RWA%(RORWA)'&chr(39) &','& chr(39)&'RORWA%'&chr(39) &')'), '$(vELPercFormula)','$(vNODPercFormula)','$(vODPercFormula)','$(vKODPercFormula)','$(vRWAPercFormula)','$(vRWAPercRORWAFormula)','$(vRORWAPercFormula)') & '<' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',2),'&chr(39)&'|'&chr(39)&',6)'), // Pick($(='WildMatch('& chr(39) & SubField(TextBetween(vColorFormatString,'||','||',2),'|',2)&chr(39) & ',' &chr(39)&'EL %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &','& chr(39)&'RWA %'&chr(39) &','& chr(39)&'RWA%(RORWA)'&chr(39) &','& chr(39)&'RORWA%'&chr(39) &')'), '$(vELPercFormula)','$(vNODPercFormula)','$(vODPercFormula)','$(vKODPercFormula)','$(vRWAPercFormula)','$(vRWAPercRORWAFormula)','$(vRORWAPercFormula)') & '=' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',2),'&chr(39)&'|'&chr(39)&',5)'), // n  Pick($(='WildMatch('& chr(39) & SubField(TextBetween(vColorFormatString,'||','||',2),'|',2)&chr(39) & ',' &chr(39)&'EL %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &','& chr(39)&'RWA %'&chr(39) &','& chr(39)&'RWA%(RORWA)'&chr(39) &','& chr(39)&'RORWA%'&chr(39) &')'), 'num(rank($(vELPercFormula),1))','num(rank($(vNODPercFormula),1))','num(rank($(vODPercFormula),1))','num(rank($(vKODPercFormula),1))','num(rank($(vRWAPercFormula),1))','num(rank($(vRWAPercRORWAFormula),1))','num(rank($(vRORWAPercFormula),1))') & '<=' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',2),'&chr(39)&'|'&chr(39)&',5)'), // n% Pick($(='WildMatch('& chr(39) & SubField(TextBetween(vColorFormatString,'||','||',2),'|',2)&chr(39) & ',' &chr(39)&'EL %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &','& chr(39)&'RWA %'&chr(39) &','& chr(39)&'RWA%(RORWA)'&chr(39) &','& chr(39)&'RORWA%'&chr(39) &')'), '$(vELPercFormula)','$(vNODPercFormula)','$(vODPercFormula)','$(vKODPercFormula)','$(vRWAPercFormula)','$(vRWAPercRORWAFormula)','$(vRORWAPercFormula)') & ' < 100-' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',2),'&chr(39)&'|'&chr(39)&',5)') , // n  Pick($(='WildMatch('& chr(39) & SubField(TextBetween(vColorFormatString,'||','||',2),'|',2)&chr(39) & ',' &chr(39)&'EL %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &','& chr(39)&'RWA %'&chr(39) &','& chr(39)&'RWA%(RORWA)'&chr(39) &','& chr(39)&'RORWA%'&chr(39) &')'), 'num(rank(-$(vELPercFormula),1))','num(rank(-$(vNODPercFormula),1))','num(rank(-$(vODPercFormula),1))','num(rank(-$(vKODPercFormula),1))','num(rank(-$(vRWAPercFormula),1))','num(rank(-$(vRWAPercRORWAFormula),1))','num(rank(-$(vRORWAPercFormula),1))') & '<=' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',2),'&chr(39)&'|'&chr(39)&',5)'), // n% Pick($(='WildMatch('& chr(39) & SubField(TextBetween(vColorFormatString,'||','||',2),'|',2)&chr(39) & ',' &chr(39)&'EL %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &','& chr(39)&'RWA %'&chr(39) &','& chr(39)&'RWA%(RORWA)'&chr(39) &','& chr(39)&'RORWA%'&chr(39) &')'), '$(vELPercFormula)','$(vNODPercFormula)','$(vODPercFormula)','$(vKODPercFormula)','$(vRWAPercFormula)','$(vRWAPercRORWAFormula)','$(vRORWAPercFormula)') & ' < ' & $(='SubField(TextBetween(vColorFormatString,'&chr(39)&'||'&chr(39)&','&chr(39)&'||'&chr(39)&',2),'&chr(39)&'|'&chr(39)&',5)'), //  Pick($(='WildMatch('& chr(39) & SubField(TextBetween(vColorFormatString,'||','||',2),'|',2)&chr(39) & ',' &chr(39)&'EL %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &','& chr(39)&'RWA %'&chr(39) &','& chr(39)&'RWA%(RORWA)'&chr(39) &','& chr(39)&'RORWA%'&chr(39) &')'), 'round($(vELPercFormula),0.0001) > round($(vELPercTOTALFormula),0.0001)', 'round($(vNODPercFormula),0.0001) > round($(vNODPercTOTALFormula),0.0001)', 'round($(vODPercFormula),0.0001) > round($(vODPercTOTALFormula),0.0001)', 'round($(vKODPercFormula),0.0001) > round($(vKODPercTOTALFormula),0.0001)', 'round($(vRWAPercFormula),0.0001) > round($(vRWAPercTOTALFormula),0.0001)', 'round($(vRWAPercRORWAFormula),0.0001) > round($(vRWAPercRORWAFormulaTotal),0.0001)', 'round($(vRORWAPercFormula),0.0001) > round($(vRORWAPercTotalFormula),0.0001)'), //  Pick($(='WildMatch('& chr(39) & SubField(TextBetween(vColorFormatString,'||','||',2),'|',2)&chr(39) & ',' &chr(39)&'EL %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &',' &chr(39)&' %'&chr(39) &','& chr(39)&'RWA %'&chr(39) &','& chr(39)&'RWA%(RORWA)'&chr(39) &','& chr(39)&'RORWA%'&chr(39) &')'), 'round($(vELPercFormula),0.0001) < round($(vELPercTOTALFormula),0.0001)', 'round($(vNODPercFormula),0.0001) < round($(vNODPercTOTALFormula),0.0001)', 'round($(vODPercFormula),0.0001) < round($(vODPercTOTALFormula),0.0001)', 'round($(vKODPercFormula),0.0001) < round($(vKODPercTOTALFormula),0.0001)', 'round($(vRWAPercFormula),0.0001) < round($(vRWAPercTOTALFormula),0.0001)', 'round($(vRWAPercRORWAFormula),0.0001) < round($(vRWAPercRORWAFormulaTotal),0.0001)', 'round($(vRORWAPercFormula),0.0001) < round($(vRORWAPercTotalFormula),0.0001)') ),'0>1') 


不同之处在于,我还将相对值公式拼接为变量,并根据字符串的内容替换了它们。 它不能以不同的方式工作或不能一直稳定地工作,它被认为是歪曲的...并且通常,最初的绝对值和相对值都在一个解析变量中,而且非常麻烦,实际上几乎不可能搜索代码错误或计算来解析所写的内容。 因此,决定划分-在某些变量中划分绝对parsim,在其他变量中划分百分比。

块6.将设置添加到表


好了,最重要的是,现在您需要根据我们分配的内容绘制表格,表格中所有字段的代码都是相同的,除了用于命名字段的输入条件之外,因此我不得不手动敲打整个东西,没有自动化,更确切地说是在第15列的某个地方它在手指的肌肉中产生,肌肉记忆得以发展。 下一个

例如,对于表的“ CRM ID”字段,代码的格式为
 if(Match('CRM ID',SubField(TextBetween(vColorFormatString,'||','||',1),'|',1)) AND ($(vColorFormatString1) OR $(vColorFormatStringPerc1)),$(vColorFormat1), If(Match('CRM ID',SubField(TextBetween(vColorFormatString,'||','||',2),'|',1)) AND ($(vColorFormatString2) OR $(vColorFormatStringPerc2)),$(vColorFormat2), If(Match('CRM ID',SubField(TextBetween(vColorFormatString,'||','||',3),'|',1)) AND ($(vColorFormatString3) OR $(vColorFormatStringPerc3)),$(vColorFormat3), If(Match('CRM ID',SubField(TextBetween(vColorFormatString,'||','||',4),'|',1)) AND ($(vColorFormatString4) OR $(vColorFormatStringPerc4)),$(vColorFormat4), If(Match('CRM ID',SubField(TextBetween(vColorFormatString,'||','||',5),'|',1)) AND ($(vColorFormatString5) OR $(vColorFormatStringPerc5)),$(vColorFormat5), If(Match('CRM ID',SubField(TextBetween(vColorFormatString,'||','||',6),'|',1)) AND ($(vColorFormatString6) OR $(vColorFormatStringPerc6)),$(vColorFormat6), If(Match('CRM ID',SubField(TextBetween(vColorFormatString,'||','||',7),'|',1)) AND ($(vColorFormatString7) OR $(vColorFormatStringPerc7)),$(vColorFormat7), If(Match('CRM ID',SubField(TextBetween(vColorFormatString,'||','||',8),'|',1)) AND ($(vColorFormatString8) OR $(vColorFormatStringPerc8)),$(vColorFormat8), If(Match('CRM ID',SubField(TextBetween(vColorFormatString,'||','||',9),'|',1)) AND ($(vColorFormatString9) OR $(vColorFormatStringPerc9)),$(vColorFormat9), If(Match('CRM ID',SubField(TextBetween(vColorFormatString,'||','||',10),'|',1)) AND ($(vColorFormatString10) OR $(vColorFormatStringPerc10)),$(vColorFormat10), )))))))))) 


例如,对于表的“ AMOUNT”字段,代码的格式为
 if(Match('AMOUNT',SubField(TextBetween(vColorFormatString,'||','||',1),'|',1)) AND ($(vColorFormatString1) OR $(vColorFormatStringPerc1)),$(vColorFormat1), If(Match('AMOUNT',SubField(TextBetween(vColorFormatString,'||','||',2),'|',1)) AND ($(vColorFormatString2) OR $(vColorFormatStringPerc2)),$(vColorFormat2), If(Match('AMOUNT',SubField(TextBetween(vColorFormatString,'||','||',3),'|',1)) AND ($(vColorFormatString3) OR $(vColorFormatStringPerc3)),$(vColorFormat3), If(Match('AMOUNT',SubField(TextBetween(vColorFormatString,'||','||',4),'|',1)) AND ($(vColorFormatString4) OR $(vColorFormatStringPerc4)),$(vColorFormat4), If(Match('AMOUNT',SubField(TextBetween(vColorFormatString,'||','||',5),'|',1)) AND ($(vColorFormatString5) OR $(vColorFormatStringPerc5)),$(vColorFormat5), If(Match('AMOUNT',SubField(TextBetween(vColorFormatString,'||','||',6),'|',1)) AND ($(vColorFormatString6) OR $(vColorFormatStringPerc6)),$(vColorFormat6), If(Match('AMOUNT',SubField(TextBetween(vColorFormatString,'||','||',7),'|',1)) AND ($(vColorFormatString7) OR $(vColorFormatStringPerc7)),$(vColorFormat7), If(Match('AMOUNT',SubField(TextBetween(vColorFormatString,'||','||',8),'|',1)) AND ($(vColorFormatString8) OR $(vColorFormatStringPerc8)),$(vColorFormat8), If(Match('AMOUNT',SubField(TextBetween(vColorFormatString,'||','||',9),'|',1)) AND ($(vColorFormatString9) OR $(vColorFormatStringPerc9)),$(vColorFormat9), If(Match('AMOUNT',SubField(TextBetween(vColorFormatString,'||','||',10),'|',1)) AND ($(vColorFormatString10) OR $(vColorFormatStringPerc10)),$(vColorFormat10), )))))))))) 


基本上就是这样。 如果描述每个菜单项,您将获得一本完整的书,例如培训手册。 很抱歉,如果有人缺少细节。

聚苯乙烯
我知道这很可能可以更优雅地完成,但是当您已经在进行此过程时,只有芯片会飞起来。 我真的不想描述菜单实现的所有细节,为什么不呢。 总的来说,本文旨在说明您如何做到这一点,也许会启发某人,并出现一个更陡峭的实现想法。

Source: https://habr.com/ru/post/zh-CN446076/


All Articles