Question on FormCalc

Not sure what functionality I need to be using but here is what I am looking to accomplish. I need to know how to count the number of rows in a table that are not  null. I have a table with data but what I need to know is how many rows  are filled out. In other words, if 5 rows out of 20 are filled out, I  need my form to tell me that 5 rows are filled in. The specific data in  the table is irrelevant for this calculation. Furthermore, I do not need the formula to validate the all columns in the row, just 1 column filled out is fine.
I tried the following formula but this is literally counting each row as  1 without looking for data. If the row is blank, I need the formula to  skip that (or count it as 0). As mentioned, I can also pinpoint a specific cell if  needed.
Count("Page2.Table1.Row1", "Page2.Table1.Row2")

I woudl do this using Javascript and not FormCalc. You will need to loop through each of the rows and test a field to see if it is populated.
You can use the RowName.instanceManager.count to get the number of Rows in your table. Then you can use that to control a For loop to lok at each row.
Lets assume your Row is called Row and the field you want to test is called Name. Each field will have a uniques name as Row[instanceMumber].Name
So your code woudl be something like this:
var NoOfRows = 0;
for (i=0;i<Row.instanceManager.count;i++){
   if (xfa.resolveNode("Row[" + i + "]").Name.rawValue != null){
     NoOfRows = NoOfRows + 1;
When this code is run it the NoOfRows variable will contain the number of rows that have a value in it.
Hope that helps
Paul

Similar Messages

  • Adobe Forms - FormCalc Scripting Question for Image Control

    Hi All,
    I have three images on my master page. I have a hidden text field. Based on a certain value within this text field I need to turn off Imagefield B and ImageField C and Leave ImageField A visible.
    I know this can be done via FormCalc scripting.
    My Questions:
    Which event shoudl I put the script in? I was thinking the textfield initialize event.
    What would be the EXACT syntax to turn turn image fields on or off?
    Please inform if know.
    Regards,
    Salil

    I solved it now, just changing the FormCalc expression.
    Instead of using the expression:
    this.value.image.href = xfa.resolveNode(this.value.image.href).value;
    I used this:
    this.value.image.href = xfa.record.Images.URL;
    The URL value of Image Field, in this case is:
    <b>$record.Images[*].URL</b>
    And, to finish, I needed to add a Text Field bounded to  <b>$record.Imagens[*].URL</b>, case else the image doesn't appear.
    That's it!

  • FORMCALC (or JS) Default date today with user override questions

    I have a date field where if null, I want today to be inserted. If the user overrides the today date and saves the form, I want the user entered date to stay.
    What I have in FORMCALC is:
    if ($.isNull)
    then
    $.rawValue = num2date(date(), DateFmt(2))
    endif
    The first part works, it populates with today, and I can overrided the date. When I save and then reopen the form, the date is "0".
    Any ideas here?

    I'm having the same problem as described above but I am using JavaScript to reflect the current date:
    var msNow = (new Date()).getTime();
    var d1 = new Date(msNow);
    this.rawValue = util.printd("mm/dd/yyyy", d1);
    The user can override the current date and save the form, BUT when the form is reopened it will run again and insert the current date over the user entered date.
    (I've tried several variations of "if (this.isNull)" to the above code which results in "01/00/0000" when opening the saved form --so it still doesn't retain the date entered by the user.)
    Does anyone know what code I need to add to to keep the user entered date that was saved with the form? Or if there is a better way to make the date calendar default to today, allow user override and save that user entered date on the form?

  • FormCalc Question for LiveCycle Designer in Acrobat 8.0

    Hi,
    I can't figure out how to write a calculation in FormCalc so that n (the number entered into the form field) multiplied by .485 equals X. This calculation is so that someone filling out the form can enter the number of miles driven and the form automatically converts the miles to the dollar amount based on the IRS mileage reimbursement. So n=some number multiplied by .485. I have tried:
    n * .0485
    n*.485
    fieldnam * .485
    and various permutations setting the parameters to "calculate" and "FormCalc". The field is currently a decimal field, and I've tried it as numeric with no luck.
    Any ideas? This is, of course, one in a series of calculations for a reimbursement form. And, as you can tell, I am a newbie. I've made plenty of forms, just none that do math.
    Thanks,
    Catherine

    Im trying to duplicate a calculation program from an xl spread sheet. After user input of variables and an initial calculation, I need to reference a specific set of data from a drop down list (possibly 15 sets) depending on the initial results. This new data then can can be used to perform further calculations and can be user altered to fine tune the calculations.
    1. Is there a way to set up a drop down list and based upon which item is selected from the list, populate a number of objects into a new set of cells?
    2. Is there a way to selectively make FormCalc perform the calculations based upon new user input? A recalc button?
    3. Is there a way to reset only part of the form in order to evaluate another set of citeria without having to re-enter the heading information?

  • FormCalc - Num2Date Question

    Hello,
    I am working on a simple form with calculating days. Basically, I need to add 7 years and 6 months onto a date entered by the user. Here is my current coding.
    if(HasValue(DateTimeField1)) then
    Num2Date( (Date2Num(SecA.DateTimeField1.formattedValue, "MM/DD/YYYY") + 2739), "MM/DD/YYYY")
    else
    null
    endif
    The problem is that it is slightly off due to leap years. I am adding the date by 2739 days because that is the closes to 7 years and 6 months. I am not sure if there is a Num2Date code that will solve the leap year problem. Thanks in advance.

    Th eonly thing I can suggest is that you use 365.25 days per year and this will give yo an additional 2 days in the calculation. This is not the most accurate but you will nly be out be a day at the worst.
    If you need something more accurate then I suggest that you do a web serach for "Date Calculations with Leap Years". There are a number of hits that will show you specifically how to do it.
    Paul

  • FormCalc. Hiding the subtotal footer in PDF form

    Hi, LCD gurus!
    I've got a problem that I'm unable to solve for a couple of days.
    There is a PDF form (consignment note) with header, lots of positions and footer. The original task with it was to make the last position of the data table be on the same page with the form footer.
    I managed to do this by adding second table (consisting of 1 row), placed in subform together with form footer. The last position of the main table was dynamically hidden, it's content was copied to the second table.
    The subform didn't allow page breaks, so my task of placing page breaks before the last position of the form was completed. It was done by Adobe
    Now the only trouble is that it is necessary to have page footers with page total on every page. That's where the problem settled.
    If I create a main table footer (calculating the totals by FormCalc) with checkbox "Include footer in final page", I need to hide it when some positions of the main page are on the same page with the second (one-row) table. Of course, I set up the footer of the second table with the necessary calculations, but it doesn't matter at the moment. The problem is that I can't figure out, where is the "tail" of the main table located until the layout:ready event has come. After that I know the page of any table position, but it's too late to hide the footer - after layout:ready hiding the footer won't lift up the second table and there's an annoying blank line in that case.
    I tried another way - not checking "Include footer in final page". Then the footer on the pre-last page of the document doesn't appear in case this page is last for the main table (and then follows page break and the second table with form footer).
    So, my global question to the form developers is - is it possible somehow to get (at least appoximately) page of form elements BEFORE the layout:ready event?
    Or is it possible to make $.presence = "hidden" of the element after layout:ready and not having blank line instead of it?
    Thanx for your reading this stuff up to this

    Hi Reeha,
    In case you need to use any script you may prefer formCalc script, which is very easy to use. You can use any script out of the two as per your understanding and comfort level.
    If you require more technical information about FormCalc, refer to the Adobe XML Forms Architecture (XFA) Specification, version 2.4, available from:
    [http://partners.adobe.com/public/developer/xml/index_arch.html.]
    and
    [http://help.adobe.com/en_US/livecycle/es/FormCalc.pdf]
    Hope this helps you
    Regards,
    Gaurav Bhardwaj

  • How to use carriage return in formcalc

    I'm sure the answer to this question is simple, but being new to formcalc (and scripting in general) I am having problems with it.
    The details:
    I have a dynamic form in livecycle. The two fields I am having problems with currently are a drop down list, and a text box (not field) associated with it. What is listed in the text box is dependant upon the choice from the dropdown list. So far everything is, functionally, working. I have the formcalc scripting event set to change on the dropdown list with the following script
    if (xfa.event.newText == "Office 1") then
         OfficeAddress1 = "123 Street Road #xD Town City, US 12121 #xD (111) 555-1414"
    endif
    "Office 1" being the dropdown selection
    OfficeAddress1 being the name of the text field
    The fake address being the address, seperated by carriage return symbols (#xD) to indicate where I want it to jump to the next line.
    The script is working fine except that the #xD symbols are showing up on the final form. How do I prevent this?
    Thanks for you assistance.

    Thanks Paul, good advice.
    For anyone that would want to do this in formcalc, the embarrassingly simple way of using a carriage return in the script is... hitting the enter button... no syntax required.
    Don't bother trying to line it up in the scripting screen (my mistake), that only puts more spaces than is necessary and will mess up the text orientation on the final form. Just hit enter and don't worry if it's not lined up, it will be.

  • New to the product - question about validating multiple fields as a group

    I have a static form that I'm building from a word document.  Part of that form requires a person to fill any 3 out 5 text fields.
    Since it looks like scripts are applied on a field by field basis, is it possible to have a script that encompasses multiple fields? 
    Would any script need to be applied to each field in turn?
    Assuming the answer to question 1 is a yes, how would you script it to require x number of fields out of a total of y to have some sort of content in order to validate?
    I'm pretty familiar with JavaScript and am looking at the Scripting reference guides but was hoping for a helping hand to get me there quicker as I'm in a bit of a time crunch - doing 18 forms with validation and database connectivity by January 15 certainly qualifies in my book.
    I would assume you'd do something like this but am unsure of the syntax...
    Get values of each field
    Set a valid counter variable for the number of fields with content
    If field 1 is not empty, increment the valid counter
    (rinse and repeat)
    if the valid counter is less than 3 throw an error message
    Many thanks in advance for any help offiered

    1). Yes, scripting within Livecycle can be for a single field or even static text, images and other artifacts within the PDF. Really anything, within Adobe's reason, when it comes to scripting.
    2). It depends on what you want to do. Things like field validations, calculations and other instances where fields are tied togther really dictate how the script runs.
    3). Fields that have calculations or validations with them work in the same, I believe. So for example I have a PDF that I made that is an Excel-type sheet that contains a few hundred cells and every single one has some type of validation or calculation associated with it. I generally run the calculations/validations from the user inputting the data and then after that the script runs, but again, it really dpeneds on what you are doing and with what, so answering some of your questions are a bit difficult.
    Javascrip/Formcalc are wonderful tools within PDF, but don't forget the Action Builder (Tools -Action Builder). It is a set of preloaded actions that are turn-key. Just select the cells that will have the action and select the result you want from the preloaded list of actions, using those actions can get you very far, and most of all; they are quick to implement without researching code. So for example, you could use the Action Builder to create an action that checks certain fields and if they are null to return a 1 value to a specific numericField (these could be hidden). Then have a "total" numericField (this would be your counter) that adds all of those fields with the 1 in it. Then create another Action Builder for that "total" numericField and if it is less than 3, display a message box that is a warning.

  • Scripting in FormCalc

    Hi,
    I am a beginner at scripting FormCalc and would appreciate some help with syntax.
    I have a questionnaire type form with groups of checkboxes: the user selects a checkbox (one of five checkboxes in each group) as a response to each of many statements.An excellent example of this type form and FormCalc scripting was provided by a helpful colleague on this forum months ago:
    http://forums.adobe.com/thread/493795?tstart=0
    Now I need to add some script so that if the user does not complete one or more checkboxes, the final total will not be calculated, until all checkboxes are selected. If a checkbox (or more) are not chosen, then instead, the user will see a text box that states: please complete all selections. Once all checkboxes are selected (checked), then the total will be calculated and displayed.
    I am a little familiar with JavaScript, but this form (based on the above sample) is done in FormCalc. In JavaScript, I would have written something like (pseudo-code):
    if (form1.page1.subform1.q1 = "")
    || (form1.page1.subform1.q2 = "")
    || (form1.page1.subform1.q3 = "")
    //etc.
    //q1 is a checkbox button group of 5 checkboxes--the form has 13 groups q1 to q13
    form1.page3.subform3.Text6 = "visible"
    else
    form1.page3.subform3.Text6 = "hide"
    //calculate the sum of q1,q2,q3,q4,q5,q6,q7,q8,q9,q10,q11,q12,q13
    Something like this. But, I don't think I can mix FormCalc and JavaScript.
    So, I'm lost and can't figure this out. Just want to make sure the user completes all 13 items (or else sees a text box asking them to complete all) so the final total is correct. If all 13 are not completed, the total will be wrong.
    Please help!
    Kind Regards,
    saratogacoach

    It is tricky to manage the presence of the message containers for each question when using the calculate event for the total. Take a look at the attached. It will calculate the total ONLY if all questions have been answered. However, the message container for each question displays '<< required' until the question is answered. It may give you some ideas for your specific requirements.
    Steve
    // form1.page1.subform1.total::calculate - (JavaScript, client)
    var q = xfa.resolveNodes("q[*]");
    var msg = xfa.resolveNodes("msg[*]");
    var total = 0;
    var a = 0;
    var missing_a = false;
    for (var i=0; i <= q.length-1; i++) {
        if (q.item(i).isNull) {
            msg.item(i).presence = "visible";
            missing_a = true;
        else {
            msg.item(i).presence = "hidden";
            a = parseInt(q.item(i).rawValue);
            total = total + a;
    if (missing_a == true) {
        this.rawValue = "";
    else {
        this.rawValue = total;

  • Adobe Form - Object property for FormCalc/Javascript

    Hi All
    I'm learning to use Adobe Form - FormCalc/Javascript - In some of the examples that I have seen fofar
    the codes (FormCalc/Javascript) used a qualified name of an object property for setting value i.e.
    In FormCalc:
    DateTimeField1.rawValue = num2date(date(), DateFmt(3))
    In Javascript:
    this.rawValue = xfa.layout.pageCount();
    pantsWaist.border.edge.color.value = "255,0,0";
    pantsLength.presence = "hidden"
    etc..
    Could someone please tell me how/where I can get the property list that available for an object ?
    (i.e. rawValue, presence, value etc...) I can't see on the Form builder (sorry for such a novice question - but as I said I am very new)
    Thanks
    Points will be rewarded for any reply -

    Hi Liem,
    Whenever u press a "." after any oject say $ in FormCalc, or this in Javascript u will find relative properties that u can set at that time for the mentioned object.
    try this, place a Text field, select that and go to script editor, select language FormCalc:
    write $. and u will find a dropdown that'll show u possible list of properties u can change.
    Similarly, if u try this with "this." in JavaScript another dropdown will show u possible list of properties that u can change.
    Hope this helps
    Regards
    Amita

  • Question About Calculation

    A previous forum user help me out by giving me this code:
    form1.#subform[0].Term_Start_Date::exit - (FormCalc, client)
    // Get the number of days from the epoch for the starting date
    var startNumber = Date2Num(Term_Start_Date.rawValue,"YYYY-MM-DD")
    // Add the lease term to the startNumber
    var diff = startNumber + LeaseTerm.rawValue
    // change back to a date
    Term_End_Date.rawValue = Num2Date(diff, "YYYY-MM-DD")
    This allows me to calculate a lease date based on start date and lease length. It works like a dream. My question is currently once I choose the lease term and the lease start date I must manually click on the Term_End_Date to have it populate properly. I have this code in the "exit*" section. Is there anyway to have the field auto populate once a user pick a begining date, essentialy eliminating the need for a user to click on the Term_End_Date field?
    Thanks to the memeber's.

    You could put it on the change event of the start date field. That will populate the enddate when a start date is chosen. Now if they decide to change the lease period after the start date has been selected the calculation will not fire..... is that acceptable?
    Paul

  • Error SQL Concat FormCalc

    hello
    I'm starting with FormCalc, and I have my first question.
    line "a" is correct when SelectField field was numeric. BUT I changed the field SelectField to text, and I wrote the line "b" and gives me error.
    You can help me, where I have the error.
    a)
    $sourceSet.DataConnection.#command.query.select.nodes.item(0).value = Concat("Select * from OfficeSupplies Where ID = ", Ltrim(Rtrim(SelectField.rawValue)) ,"")
    b)
    $sourceSet.DataConnection.#command.query.select.nodes.item(0).value = Concat("Select * from OfficeSupplies Where ID = ",SelectField.rawValue,"")
    Thank you very much

    hello
    I'm starting with FormCalc, and I have my first question.
    line "a" is correct when SelectField field was numeric. BUT I changed the field SelectField to text, and I wrote the line "b" and gives me error.
    You can help me, where I have the error.
    a)
    $sourceSet.DataConnection.#command.query.select.nodes.item(0).value = Concat("Select * from OfficeSupplies Where ID = ", Ltrim(Rtrim(SelectField.rawValue)) ,"")
    b)
    $sourceSet.DataConnection.#command.query.select.nodes.item(0).value = Concat("Select * from OfficeSupplies Where ID = ",SelectField.rawValue,"")
    Thank you very much

  • Adding Date/Time Field + X Number of Days - Basic Calculation Question

    I am assuming this is a basic calculation question. New to Adobe LiveCycle Forms.
    I have a simple form containing a table. The table appears as such:
    Text
    Formatted as Date/Time Fields
    Header 3
    Monday
    user wil choose the beginning date (Date/Time) this is DateTimeField1
    Tuesday
    this should calculate DateTimeField1 + 1
    Wednesday
    this should calculate DateTimeField1 + 2
    Thursday
    this should calculate DateTimeField1 + 3
    Friday
    this should calculate DateTimeField1 + 4
    Saturday
    this should calculate DateTimeField1 + 5
    Sunday
    this should calculate DateTimeField1 + 6
    Calculations are performed after the date is chosen for Monday. My mind tells me the simple calculation of DateTimeField1 + 1 is not going to work (and in fact doesn't!) as it needs to change Monday to a number first. I saw on another thread the following:
    Num2Date(Date2Num(Date(DateTimeField1), "DD.MM.YYYY")+7, "DD.MM.YYYY")
    Thought this was going to get me close. No cigars though!
    Any quick help is greatly appreciated. And since I am new to this, details about what needs to be changed would be great too!
    Thanks

    Here an addition for you date field.
    This FormCalc script in the exit:Event will check it the selected date is on a monday.
    If not it will go the days back until the last monday.
    var Selection = Date2Num($.formattedValue, DateFmt(2))
    var WeekDay = Num2Date(Selection, "E")
    var NewDate
    if (WeekDay eq 1) then
              NewDate = Selection - 6
    elseif (WeekDay eq 3) then
              NewDate = Selection - 1
    elseif (WeekDay eq 4) then
              NewDate = Selection - 2
    elseif (WeekDay eq 5) then
              NewDate = Selection - 3
    elseif (WeekDay eq 6) then
              NewDate = Selection - 4
    elseif (WeekDay eq 7) then
              NewDate = Selection - 5
    else
              NewDate = Selection
    endif
    $ = Num2Date(NewDate, "EEE DD.MM.YYYY")
    Hope this helps, too.

  • Events Question

    Hi folks,
    I have some general question about where to place my custom script.
    I want to compare 2 dates fields in my form(checking if the start date is not greater than the end date).
    Where should I place my code if I want to make this check and also to tell the user to select normal dates range?
    Thank you,
    Yair

    You can place in the exit event of the date fields to compare the dates..
    D1 and D2 are two date fields on my form..
    Language set to FormCalc
    Event set to Exit.
    if(D1.rawValue ne null and D2.rawValue ne null) then
    if(D1.rawValue>D2.rawValue) then
      $host.messageBox("More");
    endif
    endif
    Thanks
    Srini

  • Questions on Print Quote report

    Hi,
    I'm fairly new to Oracle Quoting and trying to get familiar with it. I have a few questions and would appreciate if anyone answers them
    1) We have a requirement to customize the Print Quote report. I searched these forums and found that this report can be defined either as a XML Publisher report or an Oracle Reports report depending on a profile option. Can you please let me know what the name of the profile option is?
    2) When I select the 'Print Quote' option from the Actions drop down in the quoting page and click Submit I get the report printed and see the following URL in my browser.
    http://<host>:<port>/dev60cgi/rwcgi60?PROJ03_APPS+report=/proj3/app/appltop/aso/11.5.0/reports/US/ASOPQTEL.rdf+DESTYPE=CACHE+P_TCK_ID=23731428+P_EXECUTABLE=N+P_SHOW_CHARGES=N+P_SHOW_CATG_TOT=N+P_SHOW_PRICE_ADJ=Y+P_SESSION_ID=c-RAuP8LOvdnv30grRzKqUQs:S+P_SHOW_HDR_ATTACH=N+P_SHOW_LINE_ATTACH=N+P_SHOW_HDR_SALESUPP=N+P_SHOW_LN_SALESUPP=N+TOLERANCE=0+DESFORMAT=RTF+DESNAME=Quote.rtf
    Does it mean that the profile in our case is set to call the rdf since it has reference to ASOPQTEL.rdf in the above url?
    3) When you click on submit button do we have something like this in the jsp code: On click call ASOPQTEL.rdf. Is the report called using a concurrent program? I want to know how the report is getting invoked?
    4) If we want to customize the jsp pages can you please let me know the steps involved in making the customizations and testing them.
    Thanks and Appreciate your patience
    -PC

    1) We have a requirement to customize the Print Quote report. I searched these forums and found that this report can be defined either as a XML Publisher report or an Oracle Reports report depending on a profile option. Can you please let me know what the name of the profile option is?
    I think I posted it in one of the threads2) When I select the 'Print Quote' option from the Actions drop down in the quoting page and click Submit I get the report printed and see the following URL in my browser.
    http://<host>:<port>/dev60cgi/rwcgi60?PROJ03_APPS+report=/proj3/app/appltop/aso/11.5.0/reports/US/ASOPQTEL.rdf+DESTYPE=CACHE+P_TCK_ID=23731428+P_EXECUTABLE=N+P_SHOW_CHARGES=N+P_SHOW_CATG_TOT=N+P_SHOW_PRICE_ADJ=Y+P_SESSION_ID=c-RAuP8LOvdnv30grRzKqUQs:S+P_SHOW_HDR_ATTACH=N+P_SHOW_LINE_ATTACH=N+P_SHOW_HDR_SALESUPP=N+P_SHOW_LN_SALESUPP=N+TOLERANCE=0+DESFORMAT=RTF+DESNAME=Quote.rtf
    Does it mean that the profile in our case is set to call the rdf since it has reference to ASOPQTEL.rdf in the above url?
    Yes, your understanding is correct.3) When you click on submit button do we have something like this in the jsp code: On click call ASOPQTEL.rdf. Is the report called using a concurrent program? I want to know how the report is getting invoked?
    No, there is no conc program getting called, you can directly call a report in a browser window, Oracle reports server will execute the report and send the HTTP response to the browser.4) If we want to customize the jsp pages can you please let me know the steps involved in making the customizations and testing them.
    This is detailed in many threads.Thanks
    Tapash

Maybe you are looking for

  • My wireless keyboard is not found, My wireless keyboard is not found

    My wireless keyboard is still not found after changing batteries. What can be wrong?

  • Downloading TV episodes (or not...)?

    I have downloaded some TV episodes on one of the authorised computers (an old Dell that still runs XP and is not in the UK). I cannot now download them on any other device. Any help please?

  • Mailman: Show recip addresses in To: field

    I have a client, we're using mailman on his OS X Server 10.4 to manage several lists. The client has a new list, with a new requirement. The list is private, no self-subscription and managed by one person. For security purposes, the all recipients of

  • Tracking pad issue with Os

    Sometimes the track pad arrow is not responding correctly.  The arrow will be responsive, the screen will blink and the tracking pad becomes very erratic.

  • Update Target Group status

    Hi Experts, I want to write e function module which will import target group guid and desired status as input & it will update status of that target group. I'm using the FMs  CRM_MKTTG_TG_ST_MAINTAIN and  CRM_MKTTG_TG_SAVE. I think I'm not able to pa