Expand my Community achievements bar.

Difficulty calling a function using Action Builder

Avatar

Level 1

I am trying to write my first script so understand it needs help.

What I am trying to do is make a timesheet specific to my company.  I want to do automatic calulation when the monRegular box is entered.  I used action builder to help me set it up. 

The error message I keep getting is:

TypeError: this.resolveNode("TimeCalc").TimeCalculator() is not a function

8:XFA:form1[0]:TimeSheet[0]:monRegular[0]:enter

here is my script:

 

 

function TimeCalculator()  {

 

     var f = form1.TimeSheet.monRegular.rawValue;

 

     f = form1.TimeSheet.monOut.rawValue - form1.TimeSheet.monLin.rawValue + form1.TimeSheet.monLout.rawValue - form1.TimeSheet.monOut.rawValue;

     TimeCalculator = f;

}

what I am trying to is calculate time ate work and return that value.  I am unfamiliar with javascript.

here is what Action Builder set up for me.

 

form1.TimeSheet.monRegular::enter - (JavaScript, client)

 

//+ GENERATED - DO NOT EDIT (ID:51E32615-7D96-4FF8-8EA8-F3A9D2BCD39D CRC:2494738674)

//+ Type: Action

//+ Result1: Custom("$Node2","TimeCalculator","","returnto","$Node1")

//+ Node2: form1[0].TimeSheet[0].#variables[0].TimeCalc[0]

//+ Node1: form1[0].TimeSheet[0].monRegular[0]

//+ Condition1: NumericField("$Node1","entered","")

//+ ActionName: monRegular.enter

 

this.resolveNode("$").rawValue   = this.resolveNode("TimeCalc").TimeCalculator();

//-

Where can I go to find some good examples of how to set up fuctions and classes.  You can explain it to me all day but I need an example to understand it.

Travis

0 Replies