Date of the application for Javascript - If/Else calculations

Hello world

I'm working on a travel authorization request form. There is a section that asks you a return date departure date and total number of days.

In the field of total days, I placed a script that calculates the number of days for departure and return to date, more than 1 day. It is as if the dates are 06/01/13 - 03/06/13, the total number of days is 3, not 2.

The script is below:

var sDate1 is this.getField ("Return Date") .value;.
var sDate2 is this.getField ('Departure Date') .value;.
var oDate1 = util.scand ("mm/dd/yyyy", sDate1);
var oDate2 = util.scand ("mm/dd/yyyy", sDate2);

nJour var = 1000 * 60 * 60 24;

var eDays is Math.abs (oDate1-oDate2) /nDay + 1;.

Event.Value = Math.Round (eDays);

The problem is when the date of departure and return fields are empty, there is still a 1 in the total number of days field.

Picture1.png

I must add to this script, so that when the date of departure and return fields are empty, nothing, or at least a zero appears in the total number of days field.

Please note that I am completely new to javascript and the one I used above, I found through searches on the internet.

Thank you :-)

You can check to make sure that the two fields are not empty before calculating the number of days the conditionally.

Conditional execution and Acrobat JavaScript by Thom Parker

var sDate1 is this.getField ("Return Date") .valueAsString;.
var sDate2 is this.getField ('Departure Date') .valueAsString;.

execution only when both fields have given conditional

If (sDate1! = "" & sDate2!) = "") {}
var oDate1 = util.scand ("mm/dd/yyyy", sDate1);
var oDate2 = util.scand ("mm/dd/yyyy", sDate2);

nJour var = 1000 * 60 * 60 24;

eDays var = (Math.abs (oDate1-oDate2) / nDay) + 1;

Event.Value = Math.round (eDays);

} else {}

If the two fields empty to clear the field;

Event.Value = "";

}

I would have converted the date object to a value and turncated value of the day unit.

get the fields string;
var sDate1 is this.getField ("Return Date") .valueAsString;.
var sDate2 is this.getField ('Departure Date') .valueAsString;.
value of the field if the calculation not;
Event.Value = "";
execution only when both fields have given conditional
If (sDate1! = "" & sDate2!) = "") {}
convert date to the date object strings
var oDate1 = util.scand ("mm/dd/yyyy", sDate1);
var oDate2 = util.scand ("mm/dd/yyyy", sDate2);
nJour var = 1000 * 60 * 60 24;
convert date objects in number of days since the date of the time and turncate in days
var nDate1 = Math.floor ((oDate1) Number / nDay)
var nDate2 = Math.floor ((oDate2) Number / nDay)
calculate the difference in days and adjust their return date
Event.Value = Math.abs (nDate1 - nDate2) + 1;
} / / end of non-empty fields.

It is even possible to not use everything if using a logical value in the calculation:

get the fields string;
var sDate1 is this.getField ("Return Date") .valueAsString;.
var sDate2 is this.getField ('Departure Date') .valueAsString;.
convert date to the date object strings
var oDate1 = util.scand ("mm/dd/yyyy", sDate1);
var oDate2 = util.scand ("mm/dd/yyyy", sDate2);
nJour var = 1000 * 60 * 60 24;
convert date objects in number of days since the date of the time and turncate in days
var nDate1 = Math.floor ((oDate1) Number / nDay)
var nDate2 = Math.floor ((oDate2) Number / nDay)
calculate the difference in days and adjust the day of return and zero if the two dates null;
Event.Value = (sDate1! = "" & sDate2! = "") * (Math.abs (nDate1 - nDate2) + 1);

Tags: Acrobat

Similar Questions

  • I can't download the application for mac windows phone. The message: you are interested in the content is now available in the store. How can I synchronize microsoft limia and macbook?

    I can't download the application for mac windows phone. The message: you are interested in the content is now available in the store. How can I synchronize microsoft limia and macbook?

    Contact Ms and ask them.  Only they dictate where their application is made available.

  • Recently, I got a message saying ' not enough system resources to open the application' for example to explore or outlook express.

    ?? Resources

    My computer has been works well, but twice recently, I got a message saying ' not enough system resources to open the application' for example to explore or outlook express. Restarting it works again, but why the message?

    Hi RaymondWilson,

    ·         Did you do changes on the computer before the show?

    Follow these methods.

    Method 1: Follow these steps:

    Step 1: Start the computer in safe mode and check if the problem persists.

    Step 2: If the problem does not still in safe mode, perform a clean boot to see if there is a software conflict as the clean boot helps eliminate software conflicts.

    Note: After completing the steps in the clean boot troubleshooting, follow the section How to configure Windows to use a Normal startup state of the link to return the computer to a Normal startupmode.

    After the clean boot used to resolve the problem, you can follow these steps to configure Windows XP to start normally.

    (a) click Start, run.

    (b) type msconfigand click OK.

    (c) the System Configuration utility dialog box appears.

    (d) click the general tab, click Normal startup - load all services and device drivers and then click OK.

    (e) when you are prompted, click restart to restart the computer.

    Method 2: Perform a System Restore and check the issue persists.

  • Error Windows Explorer application has requested to terminate in an unusual way. Please contact the support team of the application for more information

    Everytime I open Windows Explorer, I get this message. A window opens called Microsoft Visual C++ Runtime Library and he says: "this application has requested the execution to terminate in an unusual way. Please contact support team of the application for more information. "I clicked the OK button, he is looking for a solution and then closes the program. Is there something to the recent update that messed up? Help, please!

    (Moved to programs)

    Hi Thom,

    I apologize for the delay in response. I suggest to follow the steps in the link below and check if it helps you.

    Follow the steps provided by M_Sion.

    https://social.technet.Microsoft.com/forums/Windows/en-us/3a6e2cfe-ef5b-4547-A832-946a3cc82e8e/Microsoft-Visual-c-runtime-library-runtime-error?Forum=w7itproappcompat

    Follow the steps provided by Srimadhwa B

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-windows_programs/Microsoft-Visual-c-runtime-library-runtime-error/f32da816-d8a7-4B05-9975-b9f4144af62b

    Let us know the status of the issue, we will help you.

  • How to clear data from the Application to SEEP

    Hi all

    Can you help me to erase the data of the application

    You can go to the calculation Manager, database properties, made a right click the type of plan and select clear and select the option - https://docs.oracle.com/cloud/latest/pbcs_common/CSCMD/ch10s06.html

    If you want to partially erase the data then you can watch a rule - https://docs.oracle.com/cloud/latest/pbcs_common/CSCMD/ch03s02s02s01.html

    See you soon

    John

  • I bought Lightroom 6 and when I open the application for Adobe Manager it does give me an option to download. Are they not turns on the map?

    I bought Lightroom 6 and when I open the application for Adobe Manager it does give me an option to download. Are they not turns on the map?

    Download & install instructions https://forums.adobe.com/thread/2003339 can help

    -includes a link to access a page to download the Adobe programs if you do not have a disk or drive

    Also go to https://forums.adobe.com/community/creative_cloud/creative_cloud_faq

  • DPS 2015 cannot launch the application for testing in my iphone via itunes

    HI everyone the recruit again! Cannot start the application for testing in my iphone via itunes version 12.2.2 IOS 8.4 6! the test application is displayed on the screen of my iphone but there is installation and gray forever?

    Any ideas? perhaps update iphone with a new 8.4.1 version?  Thanks to everyone in advance!

    https://helpx.Adobe.com/Digital-Publishing-Suite/KB/unable-install-developer-IPA.html

    Neil

  • Operation not supported. Check the log of the applications for more details.

    It is my second day of learning ColdFusion. I am able to view the .cfm pages. However, when I tried to browse/load the .cfc file, I kept getting this error.

    Operation not supported. Check the log of the applications for more details.

    Here's my simple tests codes.

    < cfproperty hint = "First CFC" >

    < cffunction name = returntype 'getValue' = 'Chain' access 'public' = >

    < cfreturn "Hellow World" >

    < / cffunction >

    < / cfproperty >

    Where is the "application log" so I can check for more details?

    You should not really 'Browse' for SWC files, in general.  But if you do, then you might want to give the function an output attribute = "Yes".

    The newspapers are easily read in the CFAdmin (go debugging & logging on the left navigation, then choose "Log Files" under this and click on "application.log" in the list of newspapers).

    Alternatively, you can also use Windows Explorer (or what file viewer your use OS) and navigate to {cfDirectory} cfusion\logs, find the file "application.log" and open it.

    HTH,

    ^_^

  • Access to the value of the application using javascript

    How can we access the value of the APPLICATION using javascript? I tried $x ('REQUEST'), but it does not work.

    Thank you

    Hello

    If you use & ASK. (including the & and the.) in your javascript directly it will be replaced by Apex with the value of the actual demand

    Andy

  • The data folder of Application for Microsoft Visual Basic Express could not be created.

    Windows 7 Ultimate 64 bit

    After the installation of Microsoft Visual Basic 2010 Express and the execution of the executable, the following message appears: file Visual Basic 2010 Express the Application data for Microsoft Visual Basic 2010 Express could not be created.

    Things, I tried to solve this problem:

    Fixing of the keys in APPDATA

    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell folders, HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders ( but they were already OK(  )

    Get full permissions on C:\ProgramData (that I had full access to already)

    Get full permissions on %LocalAppData% (that I had full access to already)

    Running Windows Update

    Vbexpress.exe running as administrator

    None of these solutions worked.

    I noticed that when I open vbexpress.exe (in \Common7\IDE\), it creates a folder in

    %LocalAppData%\Microsoft called 'VBExpress"(which has the blue font),

    VBExpress contains a folder named ' 10.0' and 10.0 has a file named vspdmc.lock with the content "{8603A3A2-D182-4916-BF8B-80A2C531F4D5}". " It is all I could really noticed. I tried running the Sysinternal tools but it has attracted more than 10 million events and counting so I kinda gave up on it. Any help would be greatly appreciated. Thank you

    Hello

    Thank you for visiting the Community Forums of Microsoft.

    Your question related to Visual Basic and seems to be more complex than what is generally answered in the Microsoft Community Forums. It is better suited for the professionals on the MSDN Forums. So I suggest you to post your questions in the MSDN Forums to get help from this link:

    http://social.msdn.Microsoft.com/forums/vstudio/en-us/home?category=VisualStudio

    Hope it will be useful.

  • Problems withdraw the application for RuntimeStore

    I have an application that listens to gps, e-mail and sms events. Because I need this application to run at startup of the bb, I used the method mentioned in many articles in kb by placing my application in the Bank to run at startup so that when my gui starts the user interface checks the runtime of the application store and proceeds accordingly. It all works perfectly. My problem comes when I need to stop the background of the GUI thread. I call shutdown in which the application stops all threads, that it is running and then I call a system.exit (0). All threads stop perfectly and closes my gui. However when I return to run the GUI with to restart the phone the waitForSingleton recover again the same background as application before having no threads running in it, and so nothing happens in the GUI (map changes). I also tried to remove the substantive application of the RuntimeStrore through .abolish. When I do cela background threads perfectly but the user interface may not start because an Exception is thrown stating that

    application running in this process... However, this is not when I call the store of runtime. Any ideas as to what I'm doing wrong?

    Thanks in advance

    if(args.length>0 && args[0].equals("gui"))
            {
    
                System.out.println("Starting GUI");
                Controller controller=waitForSingleton();
                try{
                WhereAreYouMain app=new WhereAreYouMain(controller);
                app.enterEventDispatcher();
                }
                catch(Exception e)
                {
                    System.out.println("************EXCEPTION: "+e.getMessage());
                    return;
                }
            }
            else
            {
    
                    boolean AutoStart=true;
                    if(ApplicationManager.getApplicationManager().inStartup() && AutoStart)
                    {
                        System.out.println("********************STARTING WHEREAREYOU*************************");
                    Controller app=waitForSingleton();
                    System.out.println("****************************Started WhereAreYOU**********************");
                    }
                }
            }
    
        public static Controller waitForSingleton()
        {
            RuntimeStore store=null;
            store=RuntimeStore.getRuntimeStore();
            Controller controller=null;
            controller=(Controller)store.get(AppId);
            if(controller==null)
            {
                try{
    
                store.put(AppId, new Controller());
    
                }
                catch(Exception e)
                {
                    System.out.println("Error putting app in storage"+e.getMessage());
                }
            }
            return (Controller)store.get(AppId);
        }
        public static void removeFromRuntimeStore()
        {
            RuntimeStore store=RuntimeStore.getRuntimeStore();
            store.remove(AppId);
    
        }
        public WhereAreYouMain(Controller controller)
        {
            WhereAreYouMainScreen screen=new WhereAreYouMainScreen(controller);
            controller.setMainScreen(screen);
            pushScreen(screen);
        }
    

    When stop you your application, you also have to remove all listeners?  If one of them has a reference, your application will be not eligible for garbage collection and it will remain.

    I understand that this approach (to put the application in RuntimeStore) is actually used in some articles in the KB, but I wouldn't recommend it.

    Instead, I would say put you a small 'data only' RuntimeStore object, call this myRuntimeStore object.  I - this so that you can set a reference to your UiApplication in this document, for example. Have a myRuntimeStore.setMyApp (.) method.  Now your audience can get your app if they want, using myRuntimeStore.getMyApp ().  More importantly, you can erase it and make sure that your application will.  You may encode your listeners to do nothing if your application is not present.

    However, I would like to recommend more than you do not actually store references to your application.  If you need something to initiate treatment in your application process, use a global event.  This beautifully isolates your application of your listeners.

  • OIM11G: Way to get values from dataset of the application for approval

    All,

    How get the application of dataset attribute values in the approval process? (Same as get object data in the process of approval to 9.x).

    I'm looking at the documentation http://download.oracle.com/docs/cd/E14571_01/ doc.1111 /e14309/workflow_service.htm#CIAGFJAB and that doesn't seem to be mandatory in BPEL is.

    The only way that I can think of is to take the RequestID and use the API to find the attribute values dataset query. Any other ideas?

    Kind regards
    BB

    Someone suggested in the following way:

    oracle.iam.request.vo.Request req = reqSvc.getBasicRequestData (reqId);
    String act_key = "";
    String Gestionnairecourrierelectronique = "";
    java.util.List targetEntities = req.getTargetEntities ();
    If (targetEntities! = null) {}
    for (oracle.iam.request.vo.RequestEntity requestEntity: targetEntities) {}
    java.util.List attributes = requestEntity.getEntityData ();
    for (oracle.iam.request.vo.RequestEntityAttribute attribute: attributes) {}
    {if (Attribute.GetName (.equalsIgnoreCase ("Organization")))}
    act_key = attribute.getValue (m:System.NET.SocketAddress.ToString ());
    } else {if (attribute.getName (.equalsIgnoreCase ("Manager")))
    Gestionnairecourrierelectronique = attribute.getValue (m:System.NET.SocketAddress.ToString ());
    }
    }

    Here, Manager and organization are attributes of the dataset.

    Hope this helps the other. Credit to the original supplier.

  • How do MANUALLY enter you data into the application of health 10 IOS? There is no symbol and touch edit only gives you the option to delete existing data.

    I checked in the application of the health and read the Apple support page. They show the screen for 10 IOS on an iPhone, but their instructions don't work. There is not a Plus symbol to add data manually. It has only an editing tool that you can touch and only allows you to delete data.

    Hi, rmetzker!

    To manually enter the data points in the application of health, first go to the display of data on health as shown below.

    Then select category to which you want to enter data in (I'll use body measurements for example), then press on what data you enter (measurements > weight). In the upper right corner, it will be a plus + icon for you to manually enter your own data points.

    I hope this helps!

  • How to share data in the applications between different accounts of microsoft on the same PC

    Hi, I had been using windows 8 for over a month and that you have installed a * a lot of apps on the store. Now, I have to create a separate account from microsoft on the same PC. After having created, I find no way to use apps from windows of the older account store. And, certainly, I don't want to re-download applications for use on the new account. Is there a way to share data between different accounts on the same PC selected app? Thanks in advance, Praveen.

    Hi Samuel,.

    This is a free support. However, let me provide you with assistance on the issue of not being able to use the MS Office product on different user accounts. See the articles that describe how an application installed as MS Office can be used on another user account:

    Find and start Office applications in Windows 8 or Windows RT

    Also, for your further reference:

    Application does not appear on the start screen after the passage to another user

    I hope this helps. If you need additional help, then just reply back. Also, if you are faced with other problems related to Windows, it would be better to start a new thread of your own instead of posting in the thread on the other so that the new thread is no longer visible to the community.

  • I need to install versions of the applications for a next project CC

    I work mainly with After Effects and Photoshop, not dipping only occasionally at first and always up to date as and when updates come out. I have an upcoming project, but that has been cut in versions CC (not CC 2014) of applications, and the producer/editor wants to stay in the same versions of its apps. However, it seems that the ability to download previous versions of applications through the creative cloud went. What is the best way to get these back?

    Also! Is it possible to your direct link first CC at SpeedGrade CC 2014? SpeedGrade is the application that need me the changes between versions of the.

    Thank you!

    Hi BBOnlineB,

    If you look closely, there is an option for the previous version in there. Click on that and all applications would have a small ward arrow down on the button INSTALL. You can click on this little arrow down and CC would be available to install.

    I hope it helps.

    P.S. If you use the adobe forums, please check useful/correct responses of staff or assistance, if there is.

    Concerning

    Ludo has

Maybe you are looking for