Please enable JavaScript to view this site.

Knowledge Bridge Documentation

Help version: 3.3.8

Navigation: Self-guided Training > Unit 20: Word Integration

Set up the WordDocument Design

Scroll Prev Top Next More

 

In the WordDocument Design, you need to set 3 basic Parameter Rules, as follows:

 

outputFileName: "MyWordOutput.docx"        //Paste or Type in; include the .docx file extension.

 

specName:                        "docA"                        //Paste or Type in.

 

* templateFile:                (Example:)        { name: "TableQuoteTemp.docx", 

                                         id: "30872640-b8fb-4215-a315-08d70ea8183c" }

 

* To get the correct value in your project, while in the Child tab click on templateFile and select the ‘Get RefChain’, then click on ‘TableQuoteTemp.docx’ in the Resources folder. The value will automatically show up in the Parameter window.

 

WordIntTableWordDoc1

         

Details around the WordDocument Parameters:

RULE NAME

TYPE

DEFAULTS

CATEGORY

FLAGS

outputFileName

String

"outputDoc.docx" 

Word Utilities

Cached
Parameter

specName

String

"default" 

Word Utilities

Cached
Parameter

templateFile

File

{}

 

Word Utilities

Cached
Parameter

Required

Add Rules and Parameter Rules to WordDocument

These rules will be referenced by a rule named ‘docData’ down in ‘DocumentData’ which will be covered later.

New Rules to add to WordDocument0

Weight:         var mat = this.MaterialSelected;

if (mat == "Oak"){

                            return Math.round(40 * this.TableVolume / 12 * 100)/100;

} else if (mat == "Birch"){

                            return Math.round(38 * this.TableVolume / 12 * 100)/100;

} else if (mat == "Cherry"){

                            return Math.round(28 * this.TableVolume / 12 * 100)/100;

} else if (mat == "Walnut"){

                            return Math.round(39 * this.TableVolume / 12 * 100)/100;

} else {

                            return Math.round(28 * this.TableVolume / 12 * 100)/100;

}

//"Oak"= 40 lbs per cubic ft.

// TableVolume is in BoardFt

//BoardFt =(1" x 12" x 12")

//Cubic feet = (Board ft / 12")

 

TableVolume:        var TopLocation =    this.parent.parent.TableTopGroup.TableTop0;

var LegLocation =    this.parent.parent.LegPairGroup.LegPair0.LegGroup.Leg0;

var LegLocationQty =  R.rootModel;

var TableTopBDFT = TopLocation.volume / 144 ;

var LegBDFT = LegLocation.length * LegLocation.length * LegLocation.height / 144  ;

var LegQtyBDFT = LegLocationQty.NumberofLegs * 2 * LegBDFT;

var TableVolume = TableTopBDFT + LegQtyBDFT;

return Math.round(TableVolume);

 

//Returns board feet.(1" x 12" x 12")

// Your RefChains may vary.

// If you are having problems getting this rule to work, you can just put in a number, say 

// ‘40’, to get through the lesson.

MaterialSelected:        "Oak"

 

//"Oak"

//"Birch"

//"Cherry"

//"Walnut"

 

CostBdFt:        var mat =  this.MaterialSelected

if (mat == "Oak"){

    return 4.35;

} else if (mat == "Birch"){

    return 4.80;

} else if (mat == "Cherry"){

    return 6.15;

} else if (mat == "Walnut"){

    return 10.60;

} else {

    return 3.50;

}

 

Cost:                        return Math.round(this.CostBdFt * this.TableVolume *100) / 100;

 

LaborHours:                Math.round(this.TableVolume / 13.5 *100) / 100;

 

LaborUnitCost:        20

 

LaborCost:                Math.round(this.LaborHours * this.LaborUnitCost * 100) / 100;

 

StainAndSeal:        Math.round( this.TableVolume / .75 * 100) /100

 

SubTotal:                Math.round((this.Cost + this.LaborCost + this.StainAndSeal)*100)/100;

 

SalesTax:                6.25

 

Total:                        Math.round((this.SalesTaxTotal + this.SubTotal)*100)/100;

 

SalesTaxTotal:        Math.round(this.SalesTax/100 * this.SubTotal * 100)/100;

 

Date:                        var dt = Date();

                 return dt.substring(0,15)

 

TableDimensions:        var lg =  this.parent.parent.length

var wd =  this.parent.parent.width

var ht =  this.parent.parent.height

return lg.toString()+"L X " + wd.toString() + "W X "+ ht.toString()+"H"

// Your RefChain may vary.

 

 

The list of Rules available to WordDocument include the following:

RULE NAME

TYPE

DEFAULTS

CATEGORY

FLAGS

Weight

Number

New Rule

Cached

TableVolume

Number

0

New Rule

Cached
 

MaterialSelected

 

String

 "Oak"

 

New Rule

Cached

Parameter

CostBdFt

Number

0

New Rule

Cached Parameter

Cost

Number

0

New Rule

Cached

LaborHours

Number

0

 

New Rule

Cached Parameter

 

LaborUnitCost

Number

20

New Rule

Cached Parameter

LaborCost

Number

0

New Rule

Cached

StainAndSeal

Number

0

 

New Rule

Cached Parameter

SubTotal

Number

0

New Rule

Cached

SalesTax

Number

6.25

New Rule

Cached Parameter

Total

Number

0

 

New Rule

Cached

 

SalesTaxTotal

Number

0

 

New Rule

Cached

Date

String

""

New Rule

Cached

TableDimensions

String

""

New Rule

Cached

 

Knowledge Bridge from Engingeering Intent is a full-featured engineering and sales automation environment