CalWin
  • Introduction
  • Code Snippets
  • Useful SQL statements
  • CalWin Script
    • Hardware Script
      • GetQty
      • DefineParts
      • WorkXXX
      • Script classes
        • TWorkWrapper
        • TFrameWrapper
        • TDividerWrapper
    • System script Events
      • OnAdjustStainLoad
      • OnAfterCalcItemRequirement
      • OnCalcPriceListAddition
      • OnCalcProductPurchaseDeliveryTime
      • OnCalcSalesHeaderAutoLineData
      • OnCalcSashLeadWeight
      • OnCheckFromSemiStock
      • OnCheckFromStock
      • OnCheckGlassFromStock
      • OnCheckProduct
      • OnCheckSalesheaderRules
      • OnCheckSaleslineDates
      • OnGetBatchGroup
      • OnGetClassification
      • OnGetDiscountGroup
      • OnGetElementProfile
      • OnGetLoadPoints
      • OnGetProductSourceAltParams
      • OnGetProductSourceParams
      • OnGetprofile (deprecated)
      • OnGetSaleslinesSourceParams
      • OnGetStockItemGroup
      • OnIncludeBottleneckLoad
      • OnIncludeCheckpoint
      • OnIsSpecialProduct
      • OnModifyEdgeList
      • OnModifyKickPlate
      • OnModifyVariants_Final
      • OnModifyVariants_Initial
      • OnSalesheaderPriceFinalization
      • OnSetElementJointType
      • OnSetSileDividersPos
      • OnSetTranMullDesignCode
      • OnSetTranMullDividersPos
      • Helper Procedure Repository
        • Loop ElementList
    • Machine Link
      • Machine Link Events
        • Initialize and Finalize
        • BeforeOptimization
        • PreParseMain_xxx
        • PostParseMain_xxx
        • ParseChild_xxx
        • BeforeOutput_xxx
      • How to use a search table in Machine Link
  • Brukerdokumentasjon (NOR)
    • Fullkostkalkyle
    • Bonus og markedsstøtte
    • CalWin enhet og faktor
    • Kalenderen
    • Budsjett
    • Eksport til Excel
    • Dokument-hÃ¥ndtering
  • Misc documentation
    • CalWin 64-bit Beta
    • CalWin E-Quote
    • CalWin WEB Dashboard
    • Oracle related
      • Oracle Database Server Requirements
      • Oracle DBA
        • Resize and rename data files
        • Arhivelog mode
        • LISTENER.ORA
        • Connection strings
        • Create Oracle user (schema) for CalWin
        • Create a database link
        • Password expiration
        • Add a Directory object
        • Show table space size
        • Recovery Area Space
        • ORA-00257 - not enough space in recovery file
    • CalWin Server
      • Legg til web certificate
Powered by GitBook
On this page

Was this helpful?

  1. CalWin Script
  2. System script Events

Helper Procedure Repository

Repository of helper procedures and functions that can be copied in to your script and be used from many of the different system scripts, hardware scripts etc.

Finding elements on a product

{Returns True if the product has elements of the specified elementkind 
in the specified square}
function HasElementOfKindInSquare(aProduct:TProductWrapper; 
   aElementKind:TElementKind; aSquare:integer):boolean; 
var
  I: integer;
begin
  Result := False;
  for I := 0 to aProduct.ElementList.Count - 1 do    
  begin
    if (aProduct.Elementlist.Elements[I].Elementkind = aElementKind)
      and (aProduct.Elementlist.Elements[I].Square[1] = aSquare) then
    begin
      Result := True;
      Exit;
    end;
  end;
end;
{Returns the "Piece sash" element in the specified square and level if found}
function GetSashElementInSquare(aProduct:TProductWrapper; aSquare:integer; aLevel:TLevel):TCustomElementWrapper; 
var
  I: integer;
begin
  Result := nil;
  for I := 0 to aProduct.ElementList.Count - 1 do    
  begin
    if (aProduct.Elementlist.Elements[I].Elementkind in [ekPieceSash, ekPieceDoorBlade])
      and (aProduct.Elementlist.Elements[I].Square[1] = aSquare) 
      and (aProduct.Elementlist.Elements[I].Level = aLevel) then
    begin
      Result := aProduct.Elementlist.Elements[I];
      Exit;
    end;
  end;
end;
PreviousOnSetTranMullDividersPosNextLoop ElementList

Last updated 2 years ago

Was this helpful?