Hi everyone,
I have category data and for each category we have seperate expression which we are storing in a variable like expr_compCategory(1 to N) (i.e. expr_compCategory1 , expr_compCategory2 etc) and for each expression we have specific flag like flag_compCategory(1 to N)(i.e. flag_compCategory1,flag_compCategory2,flag_compCategory3 etc). So my requirement is like whatever Category is selected for that we have set the value 1 on the corresponding flag_compCategory.
So I was trying this through in macro like ,
Category:
LOAD *,RecNo()-1 as COMP_CATEGORY_ID;
LOAD * Inline [
COMP_CATEGORY
Promos
BBA
New Channels
Initiatives
Strategy
Market Trends
Competitive Activities
Customer Inventory Strategy
Other
];
macro:
Sub ComponentBreakdown
varNo = ActiveDocument.GetVariableDescriptions.Count - 1
set compSelection = ActiveDocument.fields("COMP_CATEGORY").GetSelectedValues
set compId= ActiveDocument.fields("COMP_CATEGORY_ID").GetPossibleValues
set vComp = compId.Item(i).Number
for i = 0 to varNo
for j=0 to compId.Count - 1
If Left(ActiveDocument.GetVariableDescriptions.Item(i).Name,10) = "flag_CompC" then 'and right(ActiveDocument.GetVariableDescriptions.Item(i).Name,1) = vComp then
set objTempVar = ActiveDocument.GetVariableDescriptions.Item(i)
varname=Trim(objTempVar.Name)
Set objDestVar=ActiveDocument.Variables(varname)
objDestVar.SetContent 1,true
end if
next
next
end Sub