magiclamp
11/11/2017 - 10:55 PM

Method remove all variables containing "MLS" in the variable name from Batch/Document/Page level.

Method remove all variables containing "MLS" in the variable name from Batch/Document/Page level.

<af name="RemoveMLSCustomVariables" access="public" bInter="bInter" bDebug="bDebug">

 <h>
  This method removes all variables containing "MLS" in the variable name<br/>
  <br/>
  <b>
 Batch level will delete MLS variables at Batch level only<br/>
  Document level will delete MLS vairables at Document and Batch level  <br/>
  Page level will delete MLS variables at Page,Document and Batch level<br/>

</b> <e>
      <b>RemoveMLSCustomVariables()</b><br/>
    </e>
  </h>
  <lvl>
      Batch,Document and Page level
  </lvl>
  <ret>
    Always <b>TRUE.</b>
  </ret>
   <g>
<![CDATA[
 'to be place page level 
 RemoveMLSCustomVariables = TRUE
 Writelog("inside RemoveMLSCustomVariables...")
 Dim oDoc
 Dim oPage
 Dim oBatch
 dim intCOunt
 
 Dim levelVal
 Dim strVariableName
 Dim boolDeleteVar
 levelVal= metaword(levelVal)
  Writelog("CurrentObj.ObjectType" & CurrentObj.ObjectType)
 
  if CurrentObj.ObjectType = 0 then
   Writelog("Batch level MLS variable deletion")
  if CurrentObj.NumOfVars > 0 then
    Writelog("Count of Batch level variable"& CurrentObj.NumOfVars)
   For intCOunt = 0 to (CurrentObj.NumOfVars)
    if(instr(CurrentObj.GetVariableName(intCOunt),"MLS")>0)  then
     strVariableName=CurrentObj.GetVariableName(intCOunt)
     Writelog("Batch  variable name to delete: "& strVariableName)
     boolDeleteVar=CurrentObj.DeleteVariable(strVariableName)
    end if
   next
        end if 
  elseif CurrentObj.ObjectType = 1 then
    Writelog("Document and Batch level batch variable deletion")
  Set oBatch = CurrentObj.Parent
  if CurrentObj.NumOfVars > 0 then
   
    Writelog("Count of Document level variable"& CurrentObj.NumOfVars)
   For intCOunt = 0 to (CurrentObj.NumOfVars)
    if(instr(CurrentObj.GetVariableName(intCOunt),"MLS")>0)  then
     strVariableName=CurrentObj.GetVariableName(intCOunt)
     Writelog("Document variable name to delete: "& strVariableName)
     boolDeleteVar=CurrentObj.DeleteVariable(strVariableName)
    end if
   next
    
    
        end if 
  if oBatch is nothing then
   Writelog("there is no Batch object")
  else
   strVariableName=""
  if oBatch.NumOfVars > 0 then
   
   Writelog("Count of Batch level variable"& oBatch.NumOfVars)
   For intCOunt = 0 to (oBatch.NumOfVars)
    if(instr(oBatch.GetVariableName(intCOunt),"MLS")>0)  then
     strVariableName=oBatch.GetVariableName(intCOunt)
     Writelog("batch variable name to delete: "& strVariableName)
     boolDeleteVar=oBatch.DeleteVariable(strVariableName)
    end if
   next
    
   end if
        end if 
  elseif CurrentObj.ObjectType = 2 then
   Set oDoc = CurrentObj.Parent
  Set oBatch = CurrentObj.Parent.Parent
  
   Writelog("Page ,Document and Batch level  variable deletion")
    
    
  if CurrentObj.NumOfVars > 0 then
   
    Writelog("Count of Page level variable"& CurrentObj.NumOfVars)
   For intCOunt = 0 to (CurrentObj.NumOfVars)
    if(instr(CurrentObj.GetVariableName(intCOunt),"MLS")>0)  then
     strVariableName=CurrentObj.GetVariableName(intCOunt)
     Writelog("Page variable name to delete: "& strVariableName)
     boolDeleteVar=CurrentObj.DeleteVariable(strVariableName)
    end if
   next
    
    
        end if 
  if oDoc is nothing then
   Writelog("there is no document object")
  else
  
    
   strVariableName=""
  if oDoc.NumOfVars > 0 then
   
   Writelog("Count of Document level variable"& oDoc.NumOfVars)
   For intCOunt = 0 to (oDoc.NumOfVars)
    if(instr(oDoc.GetVariableName(intCOunt),"MLS")>0)  then
     strVariableName=oDoc.GetVariableName(intCOunt)
     Writelog("Document variable name to delete: "& strVariableName)
     boolDeleteVar=oDoc.DeleteVariable(strVariableName)
    end if
   next
    
    
        end if 
  end if
  if oBatch is nothing then
   Writelog("there is no batch object")
  else
    
   strVariableName=""
  if oBatch.NumOfVars > 0 then
   
   Writelog("Count of Batch level variable"& oBatch.NumOfVars)
   For intCOunt = 0 to (oBatch.NumOfVars)
    if(instr(oBatch.GetVariableName(intCOunt),"MLS")>0)  then
     strVariableName=oBatch.GetVariableName(intCOunt)
     Writelog("Batch variable name to delete: "& strVariableName)
     boolDeleteVar=oBatch.DeleteVariable(strVariableName)
    end if
   next
    
    
        end if 
   end if 
  end if
 
  
  
   
]]></g></af>