FormCalc Help

I wrote a custom script to validate date/time field
Here is the script in the validate event
var numOfDays=$.rawValue;
var dt=Date2Num(numOfDays,"YYYY-MM-DD");
if(dt>Date())
then
return true;
else
return false;
endif
It is showing systax error at return
I could not find the documentation for FormCal for returning values

You can look it up in Designer Help under "if expression".

Similar Messages

  • Scripting calculations for subtotal and taxes = grandtotal

    I have a work form that lists cost of work preformed. 4 amount fields, a subtotal field, tax, and grand total. I am having an issue collaborating the subtotal, taxes and grandtotal. I have googled everywhere just for basic FormCalc help but to no avail. Any help you can give me will be very much appreciated.
    this is the script I foolishly 'thought' would work.
    Subtotal - Sum(AMOUNT, AMOUNT, AMOUNT, AMOUNT)
    Tax - Sum(TOTAL * .0825)
    Grandtotal - SUM(TOTAL, TAX)
    I have ran the syntax check on all fields no errors, but I get some extremely weird output when integers are place in the amount fields.
    layout --------------
    amount
    amount
    amount
    amount
    subtotal
    taxes
    grand total
    they are all numeric fields (i don't know if all this is relevant but I'm trying to make this as easy as possible for you to troubleshoot)
    thanks in advance
    skyler

    Sklyer,
    The attached is a sample using FormCalc for what you are trying to achieve. In the future you should post requests in the LiveCycle Designer ES forum if the request does not include Barcoded Forms ES. The Designer forum is monitored more closely.
    Steve

  • Help with simple addition formcalc issue

    I know just enough to be dangerous. I'm trying to get a row in a table to add up and appear in a separate subtotal box. The error I get is "accessor amount [*] unknown." I am working from the invoice template, but I had to refigure the box after some issues. I am using the formula that appeared in the previous subtotal box, but I know I'm not referencing the table row properly.
    Each amount box has been given a name (amount1, amount 2, etc) in the binding box and the subtotal box formula I used (throught formcalc) is form1.#subform[0].Subtotal::calculate - (FormCalc, client)
    Sum(Table1.Row1-15.amount[*])
    and
    Sum(amount1, amount2, amount3, amount4...) (listing all the amount names up to 15)
    I also tried Sum(amount[*]) as the previous template did and it wouldn't work. The Subtotal box grouping is straight from the Invoice Template, not created from the table. I know I am missing something pretty basic with heirarchy, but I don't know enough about scripting to figure this out. Any help (and explanation of what I did wrong) would be greatly appreciated. Thanks!

    The accessor [*] is only used for objects with the same name, that occur once or more.
    If you have 5 fields "Amount" in one row named "Row1" then the reference syntax is
    Table1.Row1.Amout[0], Table1.Row1.Amout[1] ... Table1.Row1.Amout[4].
    To summarize those fields you use: Sum(Table1.Row1.Amout[*])
    If you have 5 rows named "Row1" and each row has one field "Amount" then the reference syntax is:
    Table1.Row1[0].Amout, Table1.Row1[1].Amout ... Table1.Row1[4].Amout
    To summarize those fields you use: Sum(Table1.Row1[*].Amout)
    Both examples only work if the object that is repeated has always the same name!

  • Help with Sum using FormCalc in Livecycle

    Hello. I'm stuck. I've been doing searches, readings, and all that on how to sum up certain cells in Livecycle. I have tried examples and tutorials and I get stuck when the application says "Error: Accessor ' ' Unknown".
    I'm such a novice in using Livecycle and I'm not a programmer. So, if someone can help me on why it does this, that would be awesome!

    Here you go.  I rename it.  Couple of things.  Too many subforms (unless you intend to do something else with this).  Also, make sure you save your forms as "dynamic" if you intend to have user enter info.  I couldn't tell if you were importing/exporting to a spreadsheet.  Note the formcalc.  Your fields need to be named the same.  In my example they are: ExpCosts.
    I'm not very good with the formcalc/java and variables but am more than willing to help with what I can

  • Need help with a FormCalc scripting

    I am new to FormCalc and need some help. I am creating an interactive PDF in which I need a FormCalc script code for the following situation. I need to have a check box initate a script in another field. For example; I have one numeric field for quanity ordered (user input) and a check box for an optional add-on. Once the check box for the add-on is selected; I need a third field to reflect the price of the add-on * the numeric value in the quanity field.
    ProductPrice     Product Quanity          Add-On                        Total Cost
    Pd1                    2                              ($300) check box            Product Price * Product Quanity  + Add-On Price (if clicked) * Product Quanity
    Can anyone help?

    That was helpful but I still can't see to get it work. In the form I am creating The field that needs to autocalc. is to be triggered by the user clicking an add-on box. I have the add-on checkbox values set as 1=check and 0=unchecked. The idea is that when the that box is checked, the "ItemTotal" field to be calculated will be triggered to then take the Quanity field and mulitply by 300. Below is the script I tried to use and the error message returned when the Add-on box is checked.
    if (Add-onBoxName == 1) then
         Quantity * 300
    Error message in Adobe Reader when box is checked:
    Script failed (language is formcalc, context is xfa[0].form[0].topmostSubform[0].Page2[0].Add-onCheckBox[0])
    script=if (Add-onCheckBox = = 1) then
    ItemTotal = Quantity * 300
    Error: syntax error near token '300' on line 4, column 0.

  • Help with respect to Formcalc r Javascript

    Hai Experts,
            Can someone help me with demo code using formcalc
             or javascript to append a new row on clicking enter on a field in a table.
      My requirement is : i have a table in my Adobe form as follows:
    <b>   Mat_no           Quantity              Plant.</b>
       when i create a adobe form and send it thru mail i able to see only one row in the table. if the user enters first row and presses enter one more should be inserted.
      can some one help me with some sample to achieve this?????
    Thanks and regards,
    Madhu

    Hi,
    You need to slightly tweak the logic here.
    Take another internal table and declare a field of type dbtable-field1.
    Now...
    TYPES: BEGIN OF t_tab3,
                   field1 TYPE dbtable-field1,
                 END OF t_tab3.
    DATA: itab3 TYPE STANDARD TABLE OF t_tab3,
               wa1 TYPE t_tab3.
    LOOP AT int_table_temp INTO wa.
    MOVE wa-field1 TO wa_wa1-field1.
    APPEND wa1 TO itab3.
    ENDLOOP.
    IF NOT itab3[] IS INITIAL. "This check is Mandatory
    select * from dbtable into table int_table_temp for all entries in
    itab3 where dbtable-field1 = itab3-field1.
    ENDIF.
    If your dbtable field has higher length, You can use the offset aswell but not the right way.
    WHERE dbtable+0(length) EQ comparision field.
    Thanks,
    Vinod.

  • Formcalc script help!

    My timesheet is a form created in livecycle es and the form looks similar to the one below my problem is in formcalc I cant figure out a way to calculate the time correctly for me what I want it to do is if I enter 12 in the sunday block 10 should then be added to straight time and 2 should be added to overtime and then if I add 12 in the monday block Straight time shoud then be 20 and overtime would then be 4 and it would continue to add the overtime of any value over 10 entered in any of the other blocks as well. and
    basically any day worked over 10 is overtime and the rest is straight time even I did not work a full 40 any help would be appreciated Thanks!
    sun
    mon
    tue
    wed
    thu
    fri
    sat
    straight time
    overtime

    I don't know if this helps but here is the script I wrote and it will work in wksunhrs1 if i put in 12 it puts 10 in wktlst1 and 2 in wktlrh1 but if I put 12 in the rest of the objects like wtlmonhrs it does not change wktlrh1 or wkmonhrs1 I need it to keep adding what it moves to wktlrh1 and wktlrh1 but it wont. any information would be very helpful Thanks!
    topmostSubform.Page1.WKTLST1::calculate - (FormCalc, client)
    var
    wktlst1 = WKSUNHRS1+WKMONHRS1+WKTUEHRS1+WKWEDHRS1+WKTHUHRS1+WKFRIHRS1
    if (WKSUNHRS1 > 10) then
    WKTLST1= 10 WKTLRH1= WKSUNHRS1 - 10endif
    if (WKMONHRS1 > 10) then
    WKTLST1= 10 WKTLRH1= WKMONHRS1 - 10endif
    if (WKTUEHRS1 > 10) then
    WKTLST1= 10 WKTLRH1=WKTUEHRS1 - 10endif
    if (WKWEDHRS1 > 10) then
    WKTLST1= 10WKTLRH1=WKWEDHRS1 - 10endif
    if (WKTHUHRS1 > 10)
    then
    WKTLST1= 10WKTLRH1=WKTHUHRS1 - 10endif
    if (WKFRIHRS1 > 10) then
    WKTLST1= 10 WKTLRH1=WKFRIHRS1 - 10
    endif

  • Please Help me with FormCalc Customized Text Field

    A while ago someone online did a great thing for me- they helped me create a Text field that would type "This document was printed on _________" and include whatever day the pdf form was printed off our employer's intranet site.
    I had a shortcut to it in my favorites and would click on it and plave it on every new document I needed it to be on.
    Since the computer I was using suddenly crashed, I cannot find the details of how to set this up again. I have a pdf form that includes the box, but when I open it in LiveCycle, it is just blank.
    This is what I saved:
    <field h="8.4935mm" name="PrintedOn" w="141.0398mm" x="-0.0001mm" y="0mm" xmlns="http://www.xfa.org/schema/xfa-template/2.5/">
       <ui>
          <textEdit>
             <border hand="right" presence="hidden">
                <?templateDesigner StyleID aped0?></border>
             <margin/>
          </textEdit>
       </ui>
       <font size="18pt" typeface="Tahoma" weight="bold">
          <fill>
             <color value="221,221,221"/>
          </fill>
       </font>
       <para hAlign="center" vAlign="middle"/>
       <bind match="none"/>
       <event activity="prePrint" ref="$host">
          <script>$.rawValue = concat("This document was printed on: ", num2date(date(), DateFmt(1)));</script>
       </event>
    </field>
    I do not remember what to do to get this working.
    I use this "Printed On" textbox ALL the time, and I need to figure out what to do to get it working again quickly.
    If there is anyone who could help me, I could also send you a sample of a form that includes it- then you can see exactly what I mean.
    If someone could remind me how to program this kind of thing in once again and save it in LiveCycle, then explain how I can put it on another computer as well, I would really, REALLY appreciate it.
    ~Chris
    PS- this one as I had it set up only prints the Printed on message/date on the first page. If it could somehow print on EVERY page of the PDF without me having to click and add it to every single page individually, that would be even better... but first things first!

    Great, got it working!
    Now just wondering, is there any way for this to appear on every page, or would I have to place this box on every page?
    I have ~20 page documents and I have had requests to have this "printed on" show up on every page, but doing so seems like ti would be very time consuming.

  • FormCalc Formula to tell the difference between two time fields if they are populated - Help please

    Hi,
    I have a cell (TotalTime1) that references two other time formatted cells (Start1 and Finish 1).
    The below formula is intended to tell the difference between the Start and Finish time if they are populated.
    I had it working without the HasValue condition but the formula was calculating when there was no value in Start1 and Finish1 (due to time format).
    This is the code I do have, it says there is an error near the last line; I am sorry if I post this in the wrong manner, I have not posted on this forum before but here goes:
    if (HasValue (Finish1)  and HasValue (Start1)) then if (Time2Num(Start1.formattedValue, "HH:MM") < Time2Num (Finish1.formattedValue, "HH:MM")) then Abs (Time2Num(Start1.formattedValue, "HH:MM") - Time2Num(Finish1.formattedValue, "HH:MM")) / (60 * 60 * 1000) else 24 - Abs (Time2Num(Finish1.formattedValue, "HH:MM") - Time2Num(Start1.formattedValue, "HH:MM")) / (60 * 60 * 1000) endif 
    Any help would be appreciated.
    Regards Fetachini

    Thanks whyisthisme,
    Your speedy response is greatly appreciated, your support has resolved my issue.
    Many thanks.
    Regards
    Fetachini

  • Help needed with FormCalc scripting in LiveCylce 8.0

    I am new to the whole form design functionality in Adobe.  I have a form that I have created that has multiple fields calculating off each other.  I have managed to get all the fields to calculate correctly, but I'm having trouble figuring out the correct formula for one field.
    After/during field 3 calculation, I need the value to return 1000.00 if greater than 1000.00 else return Field 3 amount.
    Formula
    Current
    Calculations
    Correct Calculation
    Example 1
    Correct Calculation
    Example 2
    Field 1 - Annual Salary (User enters)
    100000.00
    100000.00
    30000.00
    Field 2 - Weekly Salary (calculation is: field 1 / 52)
    1923.07
    1923.07
    576.92
    Field 3 - Benefit Maximum (calculation is: field 2 * .60)
    1153.84
    1000.00
    346.15
    Field 4 - Hidden Field (calculation is: field 3 - 100.00)
    1053.84
    900.00
    246.15
    Field 5 - Monthly Cost (calculation is: field 4 * .025)
    26.34
    22.50
    6.15
    Field 6 - Pay Period Cost (calculation is: field 5 * 12 / 26)
    12.15
    10.38
    2.83
    After/during field 3 calculation, I need the value to return 1000.00 if greater than 1000.00 else return Field 3 amount.
    Any suggestions on how to get this to work?  Tried setting this up using Java Scipt, but when I do, the fields dissapear alltogether.

    Hi,
    You have to add the attribute to each item props, try this:
    customerExitBeforeIpcItemsCreate(ItemPriceRequest[] iR, IPCItemProperties[] itemProps) {
    for (int i = 0; i < itemProps.length; i++) {
       Map theMap = itemProps<i>.getItemAttributes();
       theMap.put(("ZZITM_USAGE", "Z010");
       itemProps<i>.setItemAttributes(theMap);
    Regards,
    Ranko

  • How do I write a specific IF statement in Adobe LiveCycle's FormCalc?

    I am trying to use an IF / ELSEIF  formula in FormCalc to autopopulate a text field in a table, but I keep  getting a syntax error.  Could someone please help?
    My table has 2 rows and 2 columns.  I named each cell (using Binding) in  Column 1 as Data1 and Data2 respectively.  Both cells in Column 1  contain a dropdown menu of numbers 1, 2, and 3.  I want to create a  FormCalc IF expression in Column 2 so that when the user selects a "1"  in the Data1 cell, the cell adjacent to it in Column 2 autopopulates to  "Yes".  Then if they select a "2", the adjacent cell becomes "No", and  if they select a "3", the adjacent cell is "Unknown".  Then, I want to  do the same thing for the Data2 cell and its adjacent cell in Column 2.
    Here is the expression that I've tried using for the first row (it  doesn't work).  (The second row in Column 2 [next to Data2] has the same  formula, except Data1 is replaced with Data2.)
    if (Data1 = 1) then
    "Yes"
    elseif (Data1 = 2) then
    "No"
    elseif (Data1 = 3) then
    "Unknown"
    endif
    Can anyone spot where my syntax error is and how to fix it?  I'd really appreciate it!  Thanks!

    Well thank you!  This actually pointed me in the right direction, however the adjacent cell is still not autopopulating depending on the number that is selected in Data1.
    I renamed the cells (in binding) for simplicity:
    Data1
    qqq1
    Data2
    qqq2
    I used this code (based on your code, just with minor tweaking):
    if (Data1.rawValue == 1) then
    qqq1.rawValue == "Yes";
    elseif (Data1.rawValue == 2) then
    qqq1.rawValue == "No" ;
    elseif (Data1.rawValue == 3) then
    qqq1.rawValue == "Unknown";
    endif
    Given the table above, with this code I do not receive an error like I did before with my erroneous code.  This part is good!  However, qqq1 still is not autopopulating to "Yes", "No", or "Unknown" when I select the different options in the dropdown of Data1.  I can't figure out what I am doing wrong!  I put the code into the Data1 cell, under the "exit" option and in the FormCalc language.  Do the cells need to be formatted a certain way?  Data1 and Data2 are both dropdown cells, and I have qqq1 and qqq2 as Text Fields with a Calculated-Read Only value.
    Is there something else that needs to be done?  I am a beginner at LiveCycle and the FormCalc language.  So any step-by-step help you can provide to the newbie will be extremely appreciated!  Thanks!  :-)

  • Help with table calculations

    Hi, all, I am working on a form that was previously made in Excel. I wanted to remake this in an expandable pdf fillable so that I can add the accessibiltiy information to the form. The first link is to the static pdf converted from Excel here:
    https://acrobat.com/#d=lIGyn*lpuWSQ-Qzkklml6w
    The second link is the the form as my strained brain has recreated it. I'm sure there is probably a better method than I have chosen and I am open to all suggestions. But I can't get the table to total.
    In the first table, all the calcs work correctly, ie 11, 12, 13, 14 and the total from 14 does show up in 15. but I need 17 to show the amount after the Discount (#16) is deducted. You would think something simple would do the trick, like SubTotal - Discount. That doesn't work.
    Column 19 should total in the footer row next to 21. It doesn't. And column 23 should total into space #24. I have been trying for hours at a time to come up with the magic script to make this form work but......now I've decided to grovel for help.
    https://acrobat.com/#d=mzovRUkKit7JnPVebPKgZw

    Hi,
    Here is your form back to you: https://acrobat.com/#d=a06D-SL7SK58ZulXCKNSuw. Please note that all of the scripts are FormCalc, as we are using the sum function and the wildcard. Neither of these will work in JavaScript.
    Have a look at this post on how to reference objects, in particular the deomonstration of Control+Click:
    http://www.assuredynamics.com/index.php/2011/05/som-expressions/
    Also with buttons with linear gradient I would change the click behaviour from Inverted to Outline or None. It will be a little easier on the eyes. I have changed the two Add buttons. Also I think that you are getting in to readibility issues with the contrast between the button background and the black caption. I would recommend a read of this post, which outlines an approach to primary buttons (like the add rows) and secondary buttons (like the delete rows):
    http://www.assuredynamics.com/index.php/2010/12/buttons/.
    Maybe this discussion on colours:
    http://www.assuredynamics.com/index.php/2011/02/any-colour-as-long-as-its-black/
    Hope that helps,
    Niall

  • Help with IF statement

    I have tried everything to make this work and no go.  Very new at this.  Thanks for the help.
    if  (InputPage.TotalComm==1) then
    "One"
    elseif  (InputPage.TotalComm==2) then
    "Two"
    elseif  (InputPage.TotalComm==3) then
    "Three"
    else
    0
    endif
    Also is there a way to convert numbers into text (1,500>> One Thousand Five Hundred)?  
    Bill

    Bill,
    Is 'TotalComm' a numeric field or a text field?
    Is 'TotalComm' the target for 'One', 'Two', 'Three', and 0?
    Why is '0' not 'Zero'?
    If 'TotalComm' is a text field and you want to replace the numeric value of 'TotalComm' with the text equivalent of the number, place the following FormCalc script in the exit event of 'TotalComm'
    // form1.InputPage.TotalComm::exit - (FormCalc, client)
    $ = WordNum(TotalComm)
    There are rules about WordNum() you should be aware of. For example,
         - if you enter '1234', WordNum() will output 'One Thousand Two Hundred Thirty-four'
         - if you enter '1,234', WordNum() will output '********' because it cannot interpret the comma
    For Designer help see http://livedocs.adobe.com/livecycle/8.2/acrobat_designer/wwhelp/wwhimpl/js/html/wwhelp.htm
    For WordNum() function, see http://livedocs.adobe.com/livecycle/8.2/acrobat_designer/001894.html
    Steve

  • Need help with IF Statement!!!

    I am trying to write an IF statement using FormCalc in LiveCycle. I have cell "tpe" which captures total points. I would like to assign levels based on the number of points achieved. For example, level I = 1001-1985; level II = 851-1000; level III = 551-850; level IV = <551. I want cell "level" to show either I, II, III or IV, based on the points in cell "tpe". How can I do this? I have zero familiarity with FormCalc or scrips in general. Can someone please help me with this? Would appreciate any help!! Thanks!

    This is what it says:
    topmostSubform.Page3.tpe::calculate - (FormCalc, client)
    sum (rrtotal, programtotal, financetotal, leadershiptotal, executivetotal, meetingstotal, filestotal, brotherhoodtotal, conferencetotal, communicationstotal, minutestotal, standardstotal, basileustotal, abtotal, gramtotal, antigramtotal, tamtotal, pgramtotal, partotal, epistotal, torchtotal, hodtotal, phitotal)
    if ($ > 1000 and $ <= 1985)then
    level = "I"
    elseif ($ > 850 and $ <= 1000)then
    level = "II"
    elseif ($ > 550 and $ <= 850)then
    level = "III"
    elseif ($ <= 550)then
    level = "IV"
    else level = ""
    endif

  • JavaScript:  Help with IF Statement

    I am not familar with Java and I have been fighting with this IF statement and I cannot get it to work.  I am sure it is something fairly basic.  Can anyone help?  I have seeminly tried everything.  In this example below I am trying to check if the data the user has entered in the FAVOR field is AAA and if it is then put up a message and if it isn't then put up a different message.  My top node in my hierarcy is data and then I have a MainSubform and then a Contact02Subform.  I have this code attached to a button and notthing happens when I click the button.  If I remove the if statement and just have the message box by itself then it shows the message box.  So I know it is my IF statement and I am sure it is simple.  Help please?
    if (xfa.resolveNode("xfa.form.data.MainSubform.Contact02Subform.FAVOR").rawValue == 'AAA')
      xfa.host.messageBox("My IF"); else;  xfa.host.messageBox("My ELSE");
    endif;

    Try this.
    if (xfa.resolveNode("xfa.form.data.MainSubform.Contact02Subform.FAVOR"). rawValue == 'AAA')
              xfa.host.messageBox("My IF");
    else
               xfa.host.messageBox("My ELSE");
    endif is used in FormCalc generally not in JavaScript.
    Thanks,
    Bibhu.

Maybe you are looking for