Using isnan

I want to use isnan() function in a fortran code which I am compiling with mpif77/mpif90 or mpf95. I am getting error message
mpf95 -c main.F -xO3 -Bstatic -e -Iinclude -I/opt/SUNWhpc/HPC7.1/include -I/home/hpc2073/SPfft/SPfft_32/include
if (isnan(utau).or.isnan(ubulk)) then
^
"main.F", Line = 190, Column = 14: ERROR: IMPLICIT NONE is specified in the local scope, therefore an explicit type must be specified for function "ISNAN".
if (isnan(resid)) then
^
"main.F", Line = 2063, Column = 11: ERROR: IMPLICIT NONE is specified in the local scope, therefore an explicit type must be specified for function "ISNAN".
f90comp: 3810 SOURCE LINES
f90comp: 2 ERRORS, 0 WARNINGS, 0 OTHER MESSAGES, 0 ANSI
gmake: *** [main.o] Error 1
why is it not recognizing isnan() as intrinsic function.

I am having the same problem. I am using ISNAN() on the pc. When I ported my code to the Sun Solaris Fortran I wrote a little function:
FUNCTION HEC_ISNAN (X)
LOGICAL HEC_ISNAN
REAL X
INTEGER isn
isn = 0
isn = IR_ISNAN(X)
HEC_ISNAN = .FALSE.
IF (isn /= 0) HEC_ISNAN = .TRUE.
RETURN
That worked fine. I copied everything over to a Sun Linux Fortran and now I am getting:
hec_lib_call.o(.text+0x5b6): In function `hec_isnan_':
: undefined reference to `ir_isnan_'
make: *** [steadyx] Error 1
I tried the above suggestion about using ieee_is_nan,
FUNCTION HEC_ISNAN (X)
USE, INTRINSIC :: IEEE_ARITHMETIC, IEEE_EXCEPTIONS
~code not shown
isn = ieee_is_nan(X)
and I get the following:
USE, INTRINSIC :: IEEE_ARITHMETIC, IEEE_EXCEPTIONS
^
"hec_lib_call.f", Line = 205, Column = 58: ERROR: Unexpected syntax: "=>" was expected but found "EOS".
isn = ieee_is_nan(X)
^
"hec_lib_call.f", Line = 218, Column = 12: ERROR: Assignment of a LOGICAL expression to a INTEGER variable is not allowed.
If I take the USE... statement out, it does not find the ieee_is_nan call. Am I missing something? I'm not familiar with either the Sun or the Linux environment.
I'm using Sun Studio 12 for Linux.
Thanks for any help.

Similar Messages

  • Can anyone pls tell me how to use isNaN()

    import javax.swing.*;
    public class SalesTaxGrandTotal{ // begin class
      public static void main(String args[]){ //begin main method
          String inputString = JOptionPane.showInputDialog("Enter subtotal");
           double subTotal = 0;
           boolean tryAgain = true;
           try{
               subTotal = Double.parseDouble("inputString");
               if(double.isNaN(subTotal))              // IT SHOWS ERROR.PLS HELP ME FIX
               System.out.println(" It works!");
           catch(NumberFormatException e){
              inputString = JOptionPane.showInputDialog(
                              "Invalid subtotal. \n"
                             +"Please enter a number:");
      System.exit(0);
      } //end main method
    } //end class

    Well :) you have to write Double istead of double since Java is case sensitive and the correct class name is Double

  • Assignment with file input

    I'm not one to join boards for the purpose of asking a question, but it's here that I'm stumped, and if anyone could help, I'd really appreciate it. Here's the first part of the task:
    "Task-
    Imagine that you are an owner of a hardware store and need to keep an
    inventory that can tell you what different kind of tools you have how many of
    each you have on hand and cost of each one.
    Now do the following:
    (1) Write a program (Tool.java) that,
    (1.1) Initializes (and creates) a file ?hardware.dat?
    (1.2) lets you input that data concerning each tool, i.e. the
    program must ask the user for input and each of the user
    input is written back in the file.
    The file must have the following format:
    Record# Tool Name Qty Cost per item (A$)
    1 Electric Sander 18 35.99
    2 Hammer 128 10.00
    3 Jigsaw 16 14.25
    4 Lawn mower 10 79.50
    5 Power saw 8 89.99
    6 Screwdriver 236 4.99
    7 Sledgehammer 32 19.75
    8 Wrench 65 6.48
    (1.3) Exception handling that must be taken into account-
    (1.3.1) User must not input incorrect data
    (1.3.2) Cost of the item must be a number"
    My code is below. So, here's my problem.
    1. I tried using "isNaN" to check if the value for "quantity" is a number or not, but it produced a "cannot find symbol method" or some such, hence why I used a try and catch thing.
    The problem is, the statement in the second try thing only tests it hypothetically; i.e. it tests it, but if it IS a number, it doesn't enter a value at all. If it ISN'T a number, it properly catches the exception.
    But if I do the "nextInt" after the try and catch, I'll have to enter a new line. How can I do the catch, but also enters the value if it's true? "isNaN" would be the best method... and I'll separate everything into their own modules soon.
    2. I have the tool Name, Quantity, and Price. However, I'm unsure how to add the record number. The program can be run at any time to add a record once at a time, so the record number needs to reflect what you're adding.
    3. In the second part, "ToolDetails" reads and displays the contents of the "hardware.dat" file which the records are written to, and it also displays the total cost of all items, i.e. "Total toolName[1] cost: toolQuantity[1]*toolPrice[1]".
    4. Also in the second class "ToolDetails", there needs to be a way to select a specific record by the toolName and delete all details pertaining to it, for example, you choose "Wrench", then the program deletes the record number, quantity, and price of "Wrench".
    I apologise for my choppy code, it's what I've pieced together while testing out things. Can anyone please help me or provide guidance on where to research these things? Thanks a lot.
    import java.io.*;
    import java.util.Scanner;
    import java.lang.Exception;
    public class Tool
         public static void main(String[] args)
              PrintWriter outputStream = null;
              try
                   outputStream = new PrintWriter(new FileOutputStream("hardware.dat", true));
              catch(FileNotFoundException error)          // The above may throw an error.
              {                                             // Hence, the exception catching.
                   System.out.println("File hardware.dat not found.");
                   System.exit(0);
              Scanner toolInput = new Scanner(System.in);
              System.out.println("Enter tool name:");
              String toolName = toolInput.nextLine();          
              System.out.println("Enter quantity:");          
              String test = toolInput.nextInt().toString;
              try
                   int toolQuantity = toolInput.nextInt();
              catch(java.util.InputMismatchException ime)
                   System.out.println("Not a number.");
                   System.exit(0);
              int toolQuantity = toolInput.nextInt();
              System.out.println("Enter price of item:");
              double toolPrice = toolInput.nextDouble();
              outputStream.println(toolName + "   " + toolQuantity + "   " + toolPrice);
              outputStream.close();
              System.out.println("\nThank you, new item \"" + toolName + "\" entered.");
    }

    Hi,
    A couple of things:
    - don't put everything in the main method; you end up duplicating code and one huge method is hard to follow. Use separate methods instead.
    - when using Scanners nextInt() or nextDouble() method, it will leave the lineseparator in place which will then "clutter up" the Scanner.
    For example if the user enteres "123" and hits the return button, the String will really look like this: "123\r\n" (depending on the OS). If you now call nextInt(), the number 123 will be returned and the "\r\n" will still be in the Scanner and when the user enters another number, say 6.6 and hits return, the Scanner will then look like this: "\r\n6.6\r\n". Calling Scanners nextDouble() method will now be the cause of an exception being thrown.
    You still with me?
    So, I advise you to just read a complete line from the user with Scanners nextLine() method, and try to convert that line into a number and catch a possible NumberFormatException.
    Here's a little start. I already wrote one method for you (getIntFromUser(...)), try to finish it now:
    import java.io.*;
    import java.util.Scanner;
    // import java.lang.Exception; <-- java.lang.* classes are automatically imported
    public class Tool {
        static final Scanner toolInput = new Scanner(System.in);
        static final String fileName = "hardware.dat";
        public static void main(String[] args) {
            String toolName = getStringFromUser("Enter tool name:");  
            int quantity = getIntFromUser("Enter quantity:");       
            double price = getDoubleFromUser("Enter price of item:");
            System.out.println("You entered: '"+toolName+"', '"+quantity+"' and '"+price+"'.");
        public static int getIntFromUser(String prompt) {
            while(true) {
                System.out.print("\n"+prompt+" ");
                String line = toolInput.nextLine();
                try {
                    int number = Integer.parseInt(line);
                    return number;
                } catch(NumberFormatException e) {
                    System.out.println("Invalid, try again!");
        public static double getDoubleFromUser(String prompt) {
            // your code here
            return -1.0;
        public static String getStringFromUser(String prompt) {
            // your code here
            return "a tool name";
        public static String readFile() {
            // your code here
            // Have a look at http://javaalmanac.com/egs/java.io/ReadLinesFromFile.html
            // how to read the lines from a textfile.
            return "";
        public static void writeLineToFile(String extraLine) {
            // your code here
            // Note: before writing the 'extraLine' to the file, you should
            // read the current contents from it and write it all to the file
            // Have a look at http://javaalmanac.com/egs/java.io/WriteToFile.html
            // how to write to a textfile.
    }Good luck.

  • Jarsign passphrase -- Makefile help

    Hi folks,
    My question is more of a make question than a jarsign question. I have a make file that builds a jar and signs it. However, I don't want to have to pass the passphrase via the terminal after I call make. Is there a way to code the passphrase into the makefile so that I can simply call make and it references the saved password at the time jarsign asks for the passphrase?
    Thanks for any suggestions.

    Change all the -
    #include <GL/glut.h>
    to
    #include <GLUT/glut.h>
    and
    if ( (!((*x)>=min)) || _isnan(*x) ) { // Other compilers may use "isnan" instead of "_isnan"
    to
    if ( (!((*x)>=min)) || isnan(*x) ) { // Other compilers may use "isnan" instead of "_isnan"
    Then run this script in directory RayTraceKd to build RayTraceKd -
    [dranta:~/RayTrace/RayTrace_3.2/RayTraceKd] dir% cat build
    cd ../VrMath
    g++ -O2 -fpermissive -c *.cpp
    cd ../DataStructs
    g++ -O2 -fpermissive -c *.cpp
    cd ../Graphics
    g++ -O2 -fpermissive -c *.cpp
    cd ../OpenglRender
    g++ -O2 -fpermissive -c *.cpp
    cd ../RaytraceMgr
    g++ -O2 -fpermissive -c *.cpp
    cd ../RayTraceKd
    g++ -O2 -fpermissive -c *.cpp
    g++ -o RayTraceKd -bindatload -framework GLUT -fpermissive *.o ../VrMath/*.o ../DataStructs/*.o ../Graphics/*.o ../OpenglRender/*.o ../RaytraceMgr/*.o -L/usr/X11R6/lib -lgl -lglu

  • If(isset || empty)!

    Hello,
    I was hoping someone could give me the equivalent to PHPs
    if(isset) and if(empty) operators. I checked Adobe's ActionScript
    Dictionary and came up with nothing. Please help! I need an element
    that can check to see if a field (text, date, etc...) is empty or
    not.
    Would greatly appreciate any input, this project is for work.
    Thanks in advance,
    Michael Loring

    In ActionScript 3, you can test for null when it comes to any
    object class. For Number, you can can use isNaN (is not-a-number);
    Booleans can either be true or false. If you can have 'unset'
    Boolean, it is false by default.
    var amount:Number; // use isNaN(amount)
    var name:String; // use name == null
    var person:Person; // use person == null

  • Intel Core Duo 1.83GHz compiler optimization / makefile help

    Hi,
    I have a C listing which was originally written with unix or Windows in mind, I wonder if anyone could help me to compile it on my Intel iMac 17inch. It's a small benchmarking program so compiler optimization is important - is this possible on an Intel Core Duo (I don't expect to include threading) using XCode or gcc?
    I'm not a programmer, the original programmer does not know anything about Macs or OS X, however I would like to use this program to effectively benchmark my machine. Currently the program will not compile using the makefile I have, I can run code compiled on a G4 but it runs slow and gives a false result.
    Here's my makefile:
    obj = c-ray-f.o
    bin = c-ray-f
    CC = gcc
    CFLAGS = -O3 -ffast-math
    $(bin): $(obj)
    $(CC) -o $@ $(obj) -lm
    .PHONY: clean
    clean:
    rm -f $(obj) $(bin)
    I do not really understand what any of that lot does, nor can I get my head around compiler options (I tried looking, but found nothing that made any sense to me!)
    Any help would really really be appreciated!

    Change all the -
    #include <GL/glut.h>
    to
    #include <GLUT/glut.h>
    and
    if ( (!((*x)>=min)) || _isnan(*x) ) { // Other compilers may use "isnan" instead of "_isnan"
    to
    if ( (!((*x)>=min)) || isnan(*x) ) { // Other compilers may use "isnan" instead of "_isnan"
    Then run this script in directory RayTraceKd to build RayTraceKd -
    [dranta:~/RayTrace/RayTrace_3.2/RayTraceKd] dir% cat build
    cd ../VrMath
    g++ -O2 -fpermissive -c *.cpp
    cd ../DataStructs
    g++ -O2 -fpermissive -c *.cpp
    cd ../Graphics
    g++ -O2 -fpermissive -c *.cpp
    cd ../OpenglRender
    g++ -O2 -fpermissive -c *.cpp
    cd ../RaytraceMgr
    g++ -O2 -fpermissive -c *.cpp
    cd ../RayTraceKd
    g++ -O2 -fpermissive -c *.cpp
    g++ -o RayTraceKd -bindatload -framework GLUT -fpermissive *.o ../VrMath/*.o ../DataStructs/*.o ../Graphics/*.o ../OpenglRender/*.o ../RaytraceMgr/*.o -L/usr/X11R6/lib -lgl -lglu

  • White screen appears when using AS3 wrapper file with Captivate 7

    We had no problems with this in the past but now a white screen appears instead of the captivate running. The file is used when we use Captivate, streaming video, or HTML assessment. It triggers a complete signal to our LMS at the end. Is there anything that we are missing? The file is:
    package  {
        import flash.display.MovieClip;
        import flash.display.Sprite;
        import flash.display.Loader;
        import flash.events.MouseEvent;
        import flash.events.Event;
        import flash.events.ProgressEvent;
        import flash.net.URLRequest;
        import flash.net.URLLoader;
        import flash.system.Security;
        import BrightcovePlayer;
        import flash.media.SoundMixer;
        import caurina.transitions.Tweener;
        import caurina.transitions.properties.ColorShortcuts;
        import pipwerks.SCORM;
        import flash.external.ExternalInterface;
        public class MainWrapper extends MovieClip {
            public var loadedSwf:URLRequest;
            public var contentLoader:Loader = new Loader  ;
            public var contentContainer:Sprite;
            public var xmlLoader:URLLoader;
            public var videoList:XML;
            public var currentLoadedSection:Number;
            public var nextEnabled:Boolean = false;
            public var currentModule:Number = 0;
            public var currentContent:Number = 0;
            public var currentContentType:String;
            public var advanceBehavior:String;
            public var prevBehavior:String;
            public var previousPage:String;
            public var moveAdv:Boolean;
            public var timesAdvanced:Number = 1;
            public var numPages:Number = 1;
            public var furthestPage:Number = 0;
            public var scorm:SCORM;
            public var lmsConnected:Boolean;
            public var lessonStatus:String;
            public var success:Boolean;
            public var suspend_str:String;
            public var suspend_data:String;
            public var arrayToParse:Array;
            public var videoChoice:Number = 0;
            public var vidChoice:Number = 0; // Picks up button selections from loaded swf...default is 0 if only one ID supplied
            public var vidID:Array = new Array(); // Recieves XML supplied video IDs
            public var MC:MovieClip;
            public var swfURLChoice:Number = 0; // Picks up button selections from loaded swf...default is 0 if only one ID supplied
            public var swfURL:Array = new Array(); // Recieves XML supplied swf URLs
            public function MainWrapper() {
                // constructor code
                addEventListener(Event.ADDED_TO_STAGE,init);
            public function init(e:Event):void {
                initializeTracking();
                contentContainer = new Sprite  ;
                addChild(contentContainer);
                exit_btn.visible = false;
                main_HUD.home_btn.visible = false;
                addNavListeners();
                mainMenuVisibility(false);
                textPanel_mc.mask = panelMask_mc;
                ColorShortcuts.init();
                Security.allowDomain("http://admin.brightcove.com");
                Security.allowDomain("http://c.brightcove.com");
                Security.allowDomain("http://brightcove.com");
                BrightcovePlayer.initialize(this,onBrightcoveVideoComplete,onBrightcoveInitComplete,onBri ghtcoveVideoPlay);
            public function loadXML():void {
                xmlLoader = new URLLoader  ;
                xmlLoader.addEventListener(Event.COMPLETE,showXML);
                xmlLoader.load(new URLRequest("playlist.xml"));
            public function showXML(e:Event):void {
                trace("Line 95: Loaded XML");
                xmlLoader.removeEventListener(Event.COMPLETE,showXML);
                XML.ignoreWhitespace = true;
                videoList = new XML(e.target.data);
                numPages = videoList.module[currentModule].listedContent.length();
                trace("Line 100: numPages="+numPages);
                loadContent();
            public function mainMenuVisibility(setVis:Boolean):void {
                main_HUD.visible = textPanel_mc.visible = setVis;
            private function onBrightcoveVideoComplete() {
                trace("Line 107: video has stopped");
                endPageNav();
            private function onBrightcoveVideoPlay() {
                trace("Line 111: player is playing");
                Tweener.addTween(BrightcovePlayer.instance,{alpha:1,time:3});
                updateNav(currentContentType);
                loadMsg_mc.visible = false;
                checkForBeginning();
            private function onBrightcoveInitComplete() {
                trace("Line 118: init is complete");
                loadXML();
            public function loadContent():void {
                if (currentContent > furthestPage) {
                    furthestPage = currentContent;
                    trace("Line 125: The furthest page so far: "+furthestPage);
                saveCoursePos() //SCORM Bookmark
                var loadedContentType:String = String(videoList.module[currentModule].listedContent[currentContent]. @ type);
                currentContentType = loadedContentType;
                switch (loadedContentType) {
                    case "cap" :
                        trace("Line 133: loading a Captivate swf");
                        advanceBehavior = "next";
                        prevBehavior = "prev";
                        loadMsg_mc.visible = true;
                        BrightcovePlayer.stopAndHide();
                        mainMenuVisibility(false);
                        swfURL = videoList.module[currentModule].listedContent[currentContent].pathToContent.split(",");
                        loadedSwf = new URLRequest(String(swfURL[swfURLChoice]));
                        contentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,loadProgress);
                        contentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadComplete);
                        contentLoader.load(loadedSwf);
                        break;
                    case "swf" :
                        trace("Line 146: loading an interactive swf");
                        advanceBehavior = "next";
                        prevBehavior = "prev";
                        loadMsg_mc.visible = true;
                        BrightcovePlayer.stopAndHide();
                        swfURL = videoList.module[currentModule].listedContent[currentContent].pathToContent.split(",");
                        loadedSwf = new URLRequest(String(swfURL[swfURLChoice]));
                        trace("XXXXXXXXXXXXX "+(String(swfURL[swfURLChoice]))+" XXXXXXXXXXXXXXXXX");
                        contentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,loadProgress);
                        contentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadComplete);
                        contentLoader.load(loadedSwf);
                        break;
                    case "quiz" :
                        trace("Line 158: loading a quiz");
                        advanceBehavior = "next";
                        prevBehavior = "prev";
                        BrightcovePlayer.stopAndHide();
                          loadMsg_mc.visible = true;
                        swfURL = videoList.module[currentModule].listedContent[currentContent].pathToContent.split(",");
                        loadedSwf = new URLRequest(String(swfURL[swfURLChoice]));
                        contentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadComplete);
                        contentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,loadProgress);
                        contentLoader.load(loadedSwf);
                        break;
                    case "bcVid" :
                        checkForBeginning();
                        advanceBehavior = "next";
                        trace("Line 172: loading a Brightcove video");
                        //vidFrame_mc.visible = true;
                        //videoBG.visible = true;
                        //setChildIndex(vidFrame_mc,numChildren - 1);
                        vidID = videoList.module[currentModule].listedContent[currentContent].videoID.split(",");
                        trace(vidID);
                        BrightcovePlayer.instance.alpha = 0;
                        BrightcovePlayer.playVideo(this,0,vidID[videoChoice],140,112.5,"");
                        break;
                    default :
                        trace("Line 183: unrecognized type. check the node's 'type' attribute");
                        break;
            public function contentFadeOut():void {
                if (currentContentType == "bcVidBranch" || currentContentType == "bcVid") {
                    trace("Line 190: fading BC vid");
                    Tweener.addTween(BrightcovePlayer.instance,{alpha:0,time:.5,onComplete:doLoadNext});
                } else {
                    trace("Line 193: fading something else");
                    Tweener.addTween(contentLoader.content,{alpha:0,time:.5,onComplete:doLoadNext});
            public function movePanel(moveDir:String):void {
                switch (moveDir) {
                    case "up" :
                        if (textPanel_mc.y != 145) {
                            Tweener.addTween(textPanel_mc,{y:145,time:.5,transition:"easeOutSin"});
                        break;
                    case "down" :
                        if (textPanel_mc.y != 645) {
                            Tweener.addTween(textPanel_mc,{y:645,time:.5,transition:"easeOutSin"});
                        break;
                    default :
                        trace("Line 211: WAT. That is not a valid direction");
                        break;
               public function getSWFChoice(e:Event):void {
                   MC = MovieClip(contentLoader.content);
                   swfURLChoice = MC.swfURLChoice;
                   contentLoader.content.removeEventListener( "getSWFChoice" , getSWFChoice );
                   trace("YYYYYYYYYYYYYYYYY swfURLChoice="+swfURLChoice+" YYYYYYYYYYYYYYYYYYYY");
                playOn();
               public function getVidChoice(e:Event):void {
                   MC = MovieClip(contentLoader.content);
                   videoChoice = MC.vidChoice;
                   contentLoader.content.removeEventListener( "getVidChoice" , getVidChoice );
                   playOn();
               public function playOn() {
                   timesAdvanced++;
                   moveAdv = true;
                   contentFadeOut();
                   hideNavControls();
            public function loadComplete(e:Event):void {
                loadMsg_mc.visible = false;
                contentLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,loadComplete);
                contentLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,loadProgress);
                contentLoader.content.addEventListener("endOfContent",endContentHandler);
                   contentLoader.content.addEventListener("getSWFChoice",getSWFChoice);
                   contentLoader.content.addEventListener("getVidChoice",getVidChoice);
                Tweener.addTween(main_HUD.progBar_mc.progFill_mc,{scaleX:(currentContent) / int(numPages - 1),time:.4,transition:"easeOutSin"});
                if (currentContent == 0){
                    main_HUD.pgNum_txt.text = "Welcome";
                } else{
                    main_HUD.pgNum_txt.text = "Page " + currentContent + " of " + int(numPages - 1);
                switch (currentContentType) {
                    case "cap" :
                        contentLoader.content.addEventListener("quizAdvancePage",quizNext);
                        break;
                    case "swf" :
                        contentLoader.content.addEventListener("quizAdvancePage",quizNext);
                        break;
                    case "quiz" :
                        contentLoader.content.addEventListener("quizAdvancePage",quizNext);
                        var loadedContent = MovieClip(contentLoader.content);
                        var xmlQuizContent = videoList.module[currentModule].listedContent[currentContent].question;
                        var numQuestions = int(xmlQuizContent.length());
                        var questionArray:Array = new Array  ;
                        var choiceArray:Array = new Array  ;
                        var correctChoiceArray:Array = new Array  ;
                        var responsesArray:Array = new Array  ;
                        var passedImageArray:Array = new Array();
                        for (var i = 0; i < numQuestions; i++) {
                            questionArray.push(String(xmlQuizContent[i].questionText));
                            var tempString:String = "";
                            for (var j = 0; j < xmlQuizContent[i].answerChoice.length(); j++) {
                                tempString +=  xmlQuizContent[i].answerChoice[j] + "%";
                            choiceArray.push(tempString);
                            tempString = "";
                            correctChoiceArray.push(xmlQuizContent[i]. @ correctChoice);
                            passedImageArray.push(xmlQuizContent[i]. @ dispImage);
                            responsesArray.push(xmlQuizContent[i].responseText);
                        loadedContent.populateQuiz(questionArray,choiceArray,correctChoiceArray,responsesArray,pa ssedImageArray);
                        break;
                    default :
                        break;
                addContent();
                checkForBeginning();
            public function endContentHandler(e:Event):void {
                //here, we will enable navigation again
                trace("Line 295: END OF CONTENT");
                mainMenuVisibility(true);
                loadMsg_mc.visible = false;
                endPageNav();
                updateNav(currentContentType);
                Tweener.addTween(main_HUD.next_btn.bg,{_color:0xffffff,time:.4,transition:"easeOutSin"});
                nextEnabled = true;
                //checkFurthestPage(e.target.currentFrame);
                checkFurthestPage(currentContent);
                if (currentContent == int(numPages - 1)) {
                    setCourseToComplete();
            public function checkFurthestPage(evalNum:Number):void {
                if (isNaN(furthestPage[currentLoadedSection])) { trace("Line 312: furthestPage[currentLoadedSection] is NaN"); }
                if (evalNum > furthestPage[currentLoadedSection]) {
                    trace("Line313: currentLoadedSection is a Number");
                    furthestPage[currentLoadedSection] = evalNum;
                    trace("Line315: furthestPage[currentLoadedSection] = "+furthestPage[currentLoadedSection]);
                saveCoursePos();
            public function endPageNav():void {
                trace("Line 321: On page " + currentContent + " of " + int(numPages - 1));
                setChildIndex(main_HUD,numChildren - 1);
                if (currentContent < int(numPages - 1)) {
                    main_HUD.next_btn.visible = true;
                } else {
                    exit_btn.visible = true;
            public function hideNavControls():void {
                main_HUD.next_btn.visible = false;
                main_HUD.prev_btn.visible = false;
                exit_btn.visible = false;
            public function loadNext(me:MouseEvent):void {
                timesAdvanced++;
                moveAdv = true;
                contentFadeOut();
                hideNavControls();
            public function quizNext(e:Event):void {
                timesAdvanced++;
                moveAdv = true;
                contentFadeOut();
            public function loadPrev(me:MouseEvent):void {
                timesAdvanced--;
                trace("Line 350: loading prev");
                moveAdv = false;
                doLoadPrev();
                hideNavControls();
            public function doLoadNext():void {
                switch (advanceBehavior) {
                    case "next" :
                        currentContent++;
                        break;
                    case "noAdvance" :
                        break;
                    default :
                        for (var i in videoList.module[currentModule].listedContent) {
                            if (advanceBehavior == videoList.module[currentModule].listedContent[i].contentTitle) {
                                currentContent = i;
                        break;
                trace("Line 372: loading next");
                contentLoader.unloadAndStop();
                if (contentContainer.numChildren > 0) {
                    contentContainer.removeChild(contentLoader);
                loadContent();
            public function doLoadPrev():void {
                switch (prevBehavior) {
                    case "prev" :
                        currentContent--;
                        if (currentContent < 0) {
                            currentModule = 0;
                            currentContent = 1;
                            timesAdvanced = 2;
                            numPages = 2;
                        break;
                    default :
                        for (var i in videoList.module[currentModule].listedContent) {
                            if (prevBehavior == videoList.module[currentModule].listedContent[i].contentTitle) {
                                currentContent = i;
                        break;
                trace("Line 400: loading prev");
                contentLoader.unloadAndStop();
                if (contentContainer.numChildren > 0) {
                    contentContainer.removeChild(contentLoader);
                loadContent();
            public function addContent():void {
                contentContainer.addChild(contentLoader);
                navToTop();
                textPanelListener();
            public function loadProgress(pe:ProgressEvent):void {
                var percentageLoaded:int = (pe.bytesLoaded / pe.bytesTotal) * 100;
                trace("Line 415: Loading..." + pe.bytesLoaded + " out of " + pe.bytesTotal);
                loadMsg_mc.loadText_txt.text = String(percentageLoaded) + "%";
            public function updateNav(contentTypeCondition):void {
                trace("Line 420: Checking nav. On Page " + currentContent);
                if (currentContent == 0) {
                    main_HUD.prev_btn.visible = false;
                navToTop();
            public function checkForBeginning():void {
                trace("Line 427: Check for beginning");
                if (currentContent != 0) {
                    trace("Line 429: Is not beginning");
                    main_HUD.prev_btn.visible = true;
                } else {
                    mainMenuVisibility(false);
                if (currentContent < furthestPage) {
                    main_HUD.next_btn.visible = true;
            public function textPanelListener():void {
                if (videoList.module[currentModule].listedContent[currentContent].panelText != "_noText") {
                    trace("Line 443: should move up");
                    movePanel("up");
                    textPanel_mc.panelText_mc.gotoAndStop(videoList.module[currentModule].listedContent[curre ntContent].panelText);
                } else {
                    movePanel("down");
            public function addNavListeners():void {
                main_HUD.prev_btn.mouseChildren = false;
                main_HUD.prev_btn.addEventListener(MouseEvent.MOUSE_OVER,beginGlow);
                main_HUD.prev_btn.addEventListener(MouseEvent.MOUSE_OUT,fadeGlow);
                main_HUD.prev_btn.addEventListener(MouseEvent.CLICK,loadPrev);
                main_HUD.next_btn.mouseChildren = false;
                main_HUD.next_btn.addEventListener(MouseEvent.MOUSE_OVER,beginGlow);
                main_HUD.next_btn.addEventListener(MouseEvent.MOUSE_OUT,fadeGlow);
                main_HUD.next_btn.addEventListener(MouseEvent.MOUSE_UP,loadNext);
                exit_btn.addEventListener(MouseEvent.MOUSE_UP,navHandler);
            public function beginGlow(me:MouseEvent):void
                switch (me.target.name)
                    case "next_btn" :
                        if (nextEnabled == true)
                            Tweener.addTween(me.target.bg,{_color:0xffffff,time:.4,transition:"easeOutSin"});
                        break;
                    default :
                        Tweener.addTween(me.target.bg,{_color:0xffffff,time:.4,transition:"easeOutSin"});
                        break;
            public function fadeGlow(me:MouseEvent):void {
                Tweener.addTween(me.target.bg,{_color:0x666666,time:.4,transition:"easeOutSin"});
            public function determineSkip():void {
                if (contentLoader.numChildren) {
                    var thisContent:MovieClip = MovieClip(contentLoader.getChildAt(0));
                trace(currentLoadedSection+ "Current content: "+thisContent.currentFrame);
                trace("Line 486 - Furthest page is "+furthestPage[currentLoadedSection]+" and the current page is "+thisContent.currentFrame);
                if (furthestPage[currentLoadedSection] >= thisContent.currentFrame) {
                    trace("can skip this page");
                    Tweener.addTween(main_HUD.next_btn.bg,{_color:0xffffff,time:.4,transition:"easeOutSin"});
                    nextEnabled = true;
                } else {
                    nextEnabled = false;
                    trace("can't skip");
            public function navHandler(me:MouseEvent):void {
                    switch (me.target.name) {
                        case "next_btn" :
                            if (nextEnabled == true) {
                                nextEnabled = false;
                                main_HUD.next_btn.addEventListener(MouseEvent.MOUSE_UP,loadNext);
                                Tweener.addTween(main_HUD.next_btn.bg,{_color:0x666666,time:.2,transition:"easeOutSin"});
                                determineSkip();
                            } else {
                                trace("can't proceed yet");
                            break;
                        case "prev_btn" :
                            exit_btn.visible = false;
                            main_HUD.prev_btn.addEventListener(MouseEvent.MOUSE_UP,loadPrev);
                            determineSkip();
                            break;
                        case "exit_btn" :
                            contentLoader.unloadAndStop();
                            ExternalInterface.call("closeCourseWindow");
                            break;
            //HERE THERE BE SCORM CODE
            public function exitCourse(me:MouseEvent):void {
                ExternalInterface.call("closeCourseWindow");
            public function initializeTracking():void {
                scorm = new SCORM  ;
                lmsConnected = scorm.connect();
                if (lmsConnected) {
                    lessonStatus = scorm.get("cmi.core.lesson_status");
                    if (lessonStatus == "completed" || lessonStatus == "passed") {
                        scorm.disconnect();
                    } else {
                        success = scorm.set("cmi.core.lesson_status","incomplete");
                        scorm.save();
                        suspend_data = scorm.get("cmi.suspend_data");
                        if (suspend_data.length > 0) {
                            arrayToParse = suspend_data.split(",");
                            currentContent = parseInt(arrayToParse[0],10);
                            furthestPage = parseInt(arrayToParse[1],10);
                } else {
                    //connectionStatus_txt.text = "Could not connect to LMS.";
            public function saveCoursePos():void {
                trace("Line 554: Saving position at " + currentContent);
                var suspend_str:String = String(currentContent)+","+String(furthestPage);
                scorm.set("cmi.suspend_data",suspend_str);
                scorm.save();
            public function setCourseToComplete():void {
                trace("Line 561: Saving complteted course");
                success = scorm.set("cmi.core.lesson_status", "completed");
                scorm.disconnect();
                   lmsConnected = false;
            public function navToTop():void {
                setChildIndex(main_HUD,numChildren-1);

    You'll have to do two things.. Elaborate on exactly what you mean by a white screen appears. What is turning white? Are you generating a SWF from captivate of a screen capture session, then trying to load that SWF with a wrapper and when you do so it turns white? (In that scenario, if Captivate was looking for external assets it can't find, that'd be why). Please include more details on that.
    Second, code of this size pasted into the forum really doesn't help. You'll need to do the work to isolate exactly what part of the code you're seeing this white box appear. Run it in a debugger line by line until you witnesss it turn white and only share that small portion of code. And if you do choose to share a ton of code, please use a site like pastebin.com which will retain formatting and color coding, making it much easier to read, and then share that pastebin link.

  • Whats the best practice to simply manage data using php sql?

    Hi
    I'm trying to follow some tutorials but there is too much old material and I'm getting confused.
    This is basic. I have a db and I want to movement data from flex.
    So, this is how I'm trying to do so. As a newbie, I will try to be clear.
    I have created a simple table called "teste" using myphpadmin with only 2 fields for testing.  (id, name).
    I have created the services automaticly using flex to generate a php code.
    This code is a simple exercise with buttons to add, update, and delete a Item.
    Although there is a lot of auto-generated code, I had a lot of work (due to my ignorance) to make it work.
    It fairly works, but I know veteran users would make it better, smarter, shorter, and ALL I WANT is a better (and simple) example to follow
    Please.
    Thanks in advance
    ps. I have set my table field "name" to the 'utf8_unicode_ci' while creating it and I it seems the adobe's generated php can't handle latin chars.
    THE CODE AS FOLLOWS:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                      xmlns:s="library://ns.adobe.com/flex/spark"
                      xmlns:mx="library://ns.adobe.com/flex/mx"
                      minWidth="955" minHeight="600"
                      xmlns:valueObjects="valueObjects.*"
                      xmlns:testeservice="services.testeservice.*"
                      creationComplete="application1_creationCompleteHandler()" >
    <fx:Script>
              <![CDATA[
                   import mx.collections.ArrayCollection;
                   import mx.controls.Alert;
                   import mx.events.FlexEvent;
                   import mx.events.ListEvent;               
                   import spark.events.IndexChangeEvent;
                   import spark.events.TextOperationEvent;               
                   //selected item
                   public var selId:int;
                   //------GET ITEM (init)------------------------------------------------------
                   protected function application1_creationCompleteHandler():void
                        tx_edit.addEventListener(KeyboardEvent.KEY_UP,parallelEdit)
                        getAllTesteResult.token = testeService.getAllTeste();                    
                   //------SELECTED ITEM ID------------------------------------------------------          
                   protected function list_changeHandler(event:IndexChangeEvent):void
                        selId = event.currentTarget.selectedItem.id;
                        lb_selectedId.text = "sel id: "+ selId;
                        if(tb_edit.selected) tx_edit.text = event.currentTarget.selectedItem.name;
                   //------ADD ITEM-----------------------------------------------------
                   protected function button_clickHandler(event:MouseEvent):void
                        var teste2:Teste     =     new Teste();
                        teste2.name                = nameTextInput.text;
                        createTesteResult.token = testeService.createTeste(teste2);
                        application1_creationCompleteHandler();
                   //------UPDATE ITEM (in parallel)-----------------------------------------------------
                   private function parallelEdit(e:KeyboardEvent):void
                        if(!isNaN(selId) && selId > 0){
                             if(tb_edit.selected){
                                  //uptadating
                                  teste2.id                     = selId;
                                  teste2.name                = tx_edit.text;
                                  updateTesteResult.token = testeService.updateTeste(teste2);
                   //------UPDATE ITEM (button click)-----------------------------------------------------
                   protected function button3_clickHandler(event:MouseEvent):void
                        teste2.id                     = parseInt(idTextInput2.text);
                        teste2.name                = nameTextInput2.text;
                        updateTesteResult.token = testeService.updateTeste(teste2);
                   //------DELETE ITEM------------------------------------------------------     
                   protected function button2_clickHandler(event:MouseEvent):void
                        if(!isNaN(selId) && selId > 0)     deleteTesteResult.token = testeService.deleteTeste(selId);
              ]]>
         </fx:Script>
         <fx:Declarations>
              <!-- this part was mostly auto generated -->
              <valueObjects:Teste id="teste"/>
              <testeservice:TesteService id="testeService" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
              <s:CallResponder id="createTesteResult"/>          
              <s:CallResponder id="getAllTesteResult"/>
              <s:CallResponder id="deleteTesteResult"/>
              <s:CallResponder id="updateTesteResult"/>
              <valueObjects:Teste id="teste2"/> 
         </fx:Declarations>
              <!-- this are just visual objects. Renamed only necessary for this example
                    most lines were auto-generated-->
         <!--Create form -->
         <mx:Form defaultButton="{button}">
              <mx:FormItem label="Name">
                   <s:TextInput id="nameTextInput" text="{teste.name}"/>
              </mx:FormItem>
              <s:Button label="CreateTeste" id="button" click="button_clickHandler(event)"/>
         </mx:Form>     
         <!--Create Result -->
         <mx:Form x="10" y="117">
              <mx:FormItem label="CreateTeste">
                   <s:TextInput id="createTesteTextInput" text="{createTesteResult.lastResult as int}" />
              </mx:FormItem>
         </mx:Form>
         <!--List -->
         <s:List x="10" y="179" id="list" labelField="name" change="list_changeHandler(event)">
              <s:AsyncListView  id="anta" list="{getAllTesteResult.lastResult}" />
         </s:List>
         <!--Update in parallel -->
         <s:Label x="147" y="179" id="lb_selectedId"/>
         <s:Button x="147" y="222" label="Remove" id="button2" click="button2_clickHandler(event)"/>
         <s:TextInput x="225" y="257" id="tx_edit"/>
         <s:ToggleButton x="147" y="257" label="Edit" id="tb_edit"  />
         <!--Update with button click -->
         <mx:Form defaultButton="{button3}" x="220" y="0">
              <mx:FormItem label="Id">
                   <s:TextInput id="idTextInput2" text="{teste2.id}"/>
              </mx:FormItem>
              <mx:FormItem label="Name">
                   <s:TextInput id="nameTextInput2" text="{teste2.name}"/>
              </mx:FormItem>
              <s:Button label="UpdateTeste" id="button3" click="button3_clickHandler(event)"/>
         </mx:Form>
    </s:Application>

    Sorry - I had to read up on what a base table block was.
    I think I am. In this particular form I have one block - a customer block which has its items pulled in from the customer table, no problems there, it works fine.
    My problem is I need to make it as user friendly as possible, if the user inputs the wrong customer ID (or does not know their name) I want them to be able to scroll through the customer list using an up or down button.
    When do you have the commit_form statement run, (the OK button) after every change or after a block of changes ? Commit writes the changes to the database giving other users access to that data right ?! How often should it be used ?

  • AutoSize not working properly in TextField when using non-zero line spacing

    When using non-zero line spacing, the autoSize property is not functioning as expected, causing text fields to scroll that shouldn't.  Also, when using device fonts, the sizes of the TextFields are wrong in the Flash IDE.
    I have a TextField whose height is supposed to be dynamic, depending the width of the TextField.  wordWrap is true, the text is left aligned, and the autoSize value is flash.text.TextFieldAutoSize.LEFT.
    When the TextField's width is adjusted, the height increases or decreases as expected, but when I scroll the mouse wheel over the TextField, it allows a single line to scroll out of view.  This should not be happening.  The autoSize property should ensure the TextField is large enough to neither require nor allow scrolling.
    Has anyone else encountered this issue or know how to fix it?
    Update: Been a problem since at least 2006! > http://blog.nthsense.net/?p=46
    http://www.kirupa.com/forum/showthread.php?288955-Disabling-textfield-scrolling   Bug is caused by using a line height ("line spacing" in Flash) larger than zero, for example 1.0pt.  It looks like when I reduce the line spacing of the text field to zero, the issue goes away.  There doesn't seem to be anything wrong with how autoSize is calculating the required height of the text (i.e. it is exactly textHeight + 4 pixel gutter, and drawing the rectangle (2,2,textWidth,textHeight) aligns visually with the text), so it must have to do with how the TextField is deciding whether it needs to scroll or not, and that separate calculation is being thrown off by the non-zero line spacing.  The additional non-zero spacing at the end of the last line could be making the TextField think it needs to scroll, even though it's hight is sufficient at "textHeight + 4".  Apparently the problem manifests when using a non-zero leading value as well.
    In fact, it has to be related to the leading value exactly, since the following code stops the textfield from scrolling.
    //body is TextField
    var tlm:TextLineMetrics = body.getLineMetrics(body.numLines - 1);
    trace(tlm.leading); //traces "1" here.  traces zero when line spacing is zero, and traces larger values with larger line spacing values
    body.autoSize = flash.text.TextFieldAutoSize.NONE; //turn off autosize so the height can be set manually
    body.height += tlm.leading; //increase height of textfield by leading value of last line to cause scrolling to be turned off.
    Honestly, this is pretty unacceptable bug.  First of all, scrolling should not be sensitive to trailing line spacing, because autoSize and textHeight do not include it. It need to be consistent, and I think textHeight and autoSize setting height = textHeight + 4 is correct.  Vertical scrolling should use textHeight as it's guage for whether scrolling is necessary, but instead, it's obviously involving the leading values of the last line.  At the very least, vertical scrolling should simply be disabled when autoSize is turned on and wordWrap is true, because the TextField should be big enough to fit all the text.  The workaround of manually adjusting the height is also no good, since turning autoSize back on will immediately change the size back and trigger scrolling again.  I also shouldn't have to set line spacing to zero just to use the autoSize feature, since the scrolling calculations are wrong in this way.

    No, lol.  Luckly, I replace most of my TextFields on the display list with my subclass TextFieldEx.  I just call a clone method that accepts a TextField and returns a TextFieldEx with identical properties.
    I corrected the problem via modifying the subclass to behave differently when autoSize is not NONE and wordWrap is true.  Under those conditions, the maxScrollV and scrollV property values are fixed at 1, and the class listens for its own SCROLL event and sets scrollV to 1 when it occurs.  That allows me to leave everything else alone, including text selection, and use whatever line spacing I want.
    The modification seems to work fine so far.
    For anyone interested in doing something similar, here is a clone method that will copy a TextField.
    public static function clone( t:TextField ):TextFieldEx
                                  var te:TextFieldEx = create( "", t.width, t.type, t.multiline, t.wordWrap, t.selectable, t.embedFonts, t.defaultTextFormat );
                                  te.alpha = t.alpha;
                                  te.alwaysShowSelection = t.alwaysShowSelection;
                                  te.antiAliasType = t.antiAliasType;
                                  te.autoSize = t.autoSize;
                                  te.background = t.background;
                                  te.backgroundColor = t.backgroundColor;
                                  te.blendMode = t.blendMode;
                                  //te.blendShader = t.blendShader;
                                  te.border = t.border;
                                  te.borderColor = t.borderColor;
                                  te.cacheAsBitmap = t.cacheAsBitmap;
                                  te.condenseWhite = t.condenseWhite;
                                  te.displayAsPassword = t.displayAsPassword;
                                  //te.embedFonts = t.embedFonts;
                                  te.filters = t.filters;
                                  te.gridFitType = t.gridFitType;
                                  te.height = t.height;
                                  te.opaqueBackground = t.opaqueBackground;
                                  te.restrict = t.restrict;
                                  //te.selectable = t.selectable;
                                  te.sharpness = t.sharpness;
                                  te.thickness = t.thickness;
                                  te.transform = t.transform;
                                  //te.type = t.type;
                                  te.useRichTextClipboard = t.useRichTextClipboard;
                                  //te.wordWrap = t.wordWrap;
                                  //Assign text last
                                  te.htmlText = t.htmlText;
                                  return te;
    //And the create method it uses
    public static function create( text:String = "", width:Number = NaN, type:String = null, multiline:Boolean = false, wordWrap:Boolean = false, selectable:Boolean = true, embedFonts:Boolean = false, font_or_textformat:*=null, size:Object=null, color:Object=null, bold:Object=null, italic:Object=null, underline:Object=null, url:String=null, target:String=null, align:String=null, leftMargin:Object=null, rightMargin:Object=null, indent:Object=null, leading:Object=null ):TextFieldEx
                                  var tf:TextFieldEx = new TextFieldEx();
                                  tf.width = isNaN(width) ? 100 : width;
                                  tf.defaultTextFormat = (font_or_textformat is TextFormat) ? (font_or_textformat as TextFormat) : new TextFormat( font_or_textformat as String, size, color, bold, italic, underline, url, target, align, leftMargin, rightMargin, indent, leading );
                                  tf.embedFonts = embedFonts;
                                  tf.multiline = multiline;
                                  tf.wordWrap = wordWrap;
                                  tf.selectable = selectable;
                                  tf.type = type;
                                  tf.text = text; //setting text last ensures the text line metrics returns correct values
                                  //Initialize the TextField's size to fit the text.
                                  if (!multiline)
                                            //When in single-line mode and no specific width is given,
                                            //expand width to entire line.
                                            if (isNaN(width))
                                                      tf.width = tf.textWidth + 4; //match width of text
                                  //Height is always automatically adjusted to fit the text by default.
                                  //It's better than the arbitrary 100px default height.
                                  var minimum_height = tf.getLineMetrics( 0 ).height;
                                  var h:Number = tf.textHeight;
                                  tf.height = (h < minimum_height) ? (minimum_height + 4) : (h + 4); //match height of text, ensuring height is at least enough to display one line, even if there is no text
                                  return tf;

  • Error when using WETextArea and WESubmitButton

    <p>Hi again,</p><p> </p><p>I think I may have found a issue.</p><p> </p><p>if you have a form that has only a WETextArea and a WESubmitbutton that is submitting back to the same report  ( with or with out database connection) I get a error message when I click the submit button of &#39;Getform&#39; not defined.</p><p> </p><p>I have replicated this in a stand alone report with no database connection just with a parameter and the 2 we elements that is posting back to the same report. </p><p>I found this while attempting to set up  a screen to allow users to input data to the database using the WETextarea.</p><p> </p><p>Jon Roberts</p><p><a href="http://www.programmervault.com" title="www.programmervault.com">www.programmervault.com</a><br /></p><p><a href="http://www.dsi-bi.com" title="Decision Systems Inc">Decision Systems Inc </a> </p>

    hey AJ,
    unfortunately you are completely out of luck on this one as Text Area does not have a max length property associated with it. http://www.w3.org/TR/REC-html32.html
    just kidding...this is a good idea (keep them coming) and pretty quick and easy to do...so...here's some code below to give you a validation method for WETextArea.
    1) go to your Admin folder in webElements 2.1 and open up the WEValidator and replace its code with
    // WEValidator 2.1 last revision March 8, 2007, JWiseman
    Function (stringvar ElementName, stringvar Validate, stringvar Message)
    stringvar output;
    if validate > "" then
    validate:= lowercase(validate);
    if validate ="empty" then output :=
    'if(isEmpty(getform.' + ElementName + '))' +Â
    '{ ' +
    'alert("' + Message + '"); ' +
    'getform.' + ElementName + '.focus();' +
    'return;' +
    if validate in ["numeric", "number"] then output :=
    'if(isEmpty(getform.' + ElementName + '))' +Â
    '{ ' +
    'alert("' + Message + '"); ' +
    'getform.' + ElementName + '.focus();' +
    'return false; ' +
    '}' +
    'if (!isNumeric(getform.' + ElementName + '.value)) ' +
    '{ ' +
    'alert("' + Message + '"); ' +
    'getform.' + ElementName + '.focus(); ' +
    'return false;' +
    if validate in ["email", "e-mail", "email"] then output :=
    'if(isEmpty(getform.' + ElementName + '))' +Â
    '{ ' +
    'alert("' + Message + '"); ' +
    'getform.' + ElementName + '.focus();' +
    'return false; ' +
    '}' +
    'if (!isValidEmail(getform.' + ElementName + '.value)) ' +
    '{ ' +
    'alert("' + Message + '"); ' +
    'getform.' + ElementName + '.focus(); ' +
    'return false;' +
    if validate = "date" then output :=
    'if(isEmpty(getform.' + ElementName + '))' +Â
    '{ ' +
    'alert("' + Message + '"); ' +
    'getform.' + ElementName + '.focus();' +
    'return false; ' +
    '}' +
    'if (!isDate(getform.' + ElementName + '.value)) ' +
    '{ ' +
    'alert("' + Message + '"); ' +
    'getform.' + ElementName + '.focus(); ' +
    'return false;' +
    if validate = "integer" then output :=
    'if(isEmpty(getform.' + ElementName + '))' +Â
    '{ ' +
    'alert("' + Message + '"); ' +
    'getform.' + ElementName + '.focus();' +
    'return false; ' +
    '}' +
    'if (!isInteger(getform.' + ElementName + '.value)) ' +
    '{ ' +
    'alert("' + Message + '"); ' +
    'getform.' + ElementName + '.focus(); ' +
    'return false;' +
    if validate in ["check", "checked", "select", "selected"] then output :=
    'if(!isButtonChecked(getform.' + ElementName + '))' +Â
    '{ ' +
    'alert("' + Message + '"); ' +
    'return; ' +
    if validate[1 to 6] = "value=" then
    (validate:= validate[7 to length(validate)];output :=
    &#39;if(isCertainValue(getform.&#39; + ElementName + &#39;,"&#39;validate&#39;"))&#39; + 
    '{ ' +
    'alert("' + Message + '"); ' +
    'getform.' + ElementName + '.focus();' +
    'return;' +
    if validate[1 to 7] = "length>" then
    (validate:= validate[8 to length(validate)];output :=
    &#39;if(isMaxLength(getform.&#39; + ElementName + &#39;,&#39;validate&#39;))&#39; +
    '{ ' +
    'alert("' + Message + '"); ' +
    'getform.' + ElementName + '.focus();' +
    'return;' +
    "<!validator " + output  + "><!|||>"
    ) else "";
    2) now open WEFunctionLibrary and replace its code with
    // WEFunctionLibrary 2.1 last revision March 8, 2007, JWiseman
    Function ()
    // functions for select all, clear all, reverse all buttons and links
    &#39;function selectAll(cbList,bSelect) {&#39; <br />&#39;for (var i=0; i<cbList.length; i+)&#39; +
    'cbList.selected = cbList.checked = bSelect&#39; <br />&#39;}&#39; <br />
    &#39;function reverseAll(cbList) {&#39; <br />&#39;for (var i=0; i<cbList.length; i+){&#39; +
    'cbList.checked = !(cbList.checked);' +
    'cbList.selected = !(cbList.selected)&#39; <br />&#39;}}&#39; <br />
    // VALIDATION FUNCTIONS
    // function for numeric (float) input validation
    'function isNumeric(sText){' +
    &#39;var ValidChars = "0123456789.";var IsNumber=true;var Char;&#39; <br />&#39;for (i = 0; i < sText.length && IsNumber == true; i+) &#39; +
    '{Char = sText.charAt(i); ' +
    'if (ValidChars.indexOf(Char) == -1) ' +
    '{IsNumber = false;}}return IsNumber;Â ' +
    +
    // function for integer input validation
    'function isInteger(sTextB){' +
    &#39;var ValidCharsB = "0123456789";var IsNumberB=true;var CharB;&#39; <br />&#39;for (i = 0; i < sTextB.length && IsNumberB == true; i+) &#39; +
    '{CharB = sTextB.charAt(i); ' +
    'if (ValidCharsB.indexOf(CharB)
    == -1) ' +
    '{IsNumberB = false;}}return IsNumberB;Â ' +
    +
    // function for non-null input validation
    'function isEmpty(aTextField) {' +
    'if ((aTextField.value.length==0) ||' +
    '(aTextField.value==null)) {' +
    &#39;return true;}else {return false;}&#39; <br />&#39;}&#39; <br />Â
    // function for email input validation
    'function isValidEmail(str){' +
    'return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);&#39; <br />&#39;}&#39; <br />
    // function for date input validation
    'function isDate(str){' +
    'var dateVar = new Date(str);' +
    'if(isNaN(dateVar.valueOf()) ||' +
    '(dateVar.valueOf() ==0))' +
    'return false;' +
    &#39;else {return true;}&#39; <br />&#39;}&#39;<br />
    // function for radio button and checkbox validation
    'function isButtonChecked(aSelection) {' +
    &#39;var checkcount = -1;&#39; <br />&#39;for (var i=0; i < aSelection.length; i+) {&#39; +
    'Â Â if (aSelection.checked) {checkcount = i; i = aSelection.length;}' +
    'Â Â }' +
    'if (checkcount > -1) return aSelection[checkcount].value;' +
    &#39;else return false;&#39; <br />&#39;}&#39;<br />
    // function for inappropriate value input validation
    'function isCertainValue(aTextField, vTextField) {' +
    'if (aTextField.value==vTextField){' +
    &#39;return true;}else {return false;}&#39; <br />&#39;}&#39; <br />
    // function for maximum input length validation
    'function isMaxLength(aTextField, mLength) {' +
    'if (aTextField.value.length>mLength){' +
    'return true;}else {return false;}' +
    3) do not add these to your repository quite yet as you'll want to test this to see if there's no nasty bugs or side affects.
    4) in your WETextArea function you'll have a validation for maximum length, so your code will look something like
    WETextArea ("tb", {?tb}, "1in", "2in", "", "length>16", "there are way too many characters here")
    NOTE: this is for maximum length only and this will not do a minimum length at this time...should that need arise in the future i can create a validation for "length

  • Using value of application item in javascript

    Hello All,
    Apex 3.1
    I have a javascript that calls an application process, please see below. In the application process I have logic to set/change the value of an application item. Later in the javascript I need to set a page item to the value of the application item which was set in the application process. Any alerts that I post during the javascript show this value as blank, even though a similar HTP.prn in the application process displays the value!. After the script completes the correct value of the application item is in session state . Can someone explain this timing issue to me? Why can't I get the value of an application item in the javascript when the application process is called from the javascript?
    Is there a simple workaround here for me to get this value?
    <script>
    function f_ValidateLinkLine(pThis) {
       // The row in the table
       var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
       // is Link Line really a number? 
       if ( isNaN(html_GetElement('f20_'+vRow).value)) {
            if (html_GetElement('f20_'+vRow).value.length > 0) {
            alert('Link Line is an invalid number - '+html_GetElement('f20_'+vRow).value);
            html_GetElement('f20_'+vRow).value = '';
       } else { 
           if ( ! isNaN( parseFloat(html_GetElement('f20_'+vRow).value) ) ) {
       var link_line = parseInt(html_GetElement('f20_'+vRow).value);
       if (html_GetElement('f20_'+vRow).value.length > 0) {
          var get = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=ValidateLinkLine',0);
          get.add('F101_LINK_LINE',html_GetElement('f20_'+vRow).value);
          get.add('F101_INVENTORY_ITEM_ID',html_GetElement('inventory_item_id_'+Number(link_line)).value);
          get.add('F101_QUOTE_LINE_LINK_ID',html_GetElement('f01_'+spacer+link_line).value);
          get.add('F101_QUOTE_LINE_ID',html_GetElement('f01_'+vRow).value);
          get.add('F101_QUOTE_NUMBER',html_GetElement('f19_'+vRow).value);
          gReturn = get.get();
       // The application process can sometimes change the value of F101_QUOTE_LINE_ID
      //  and I need to set f37 to this value when this happens
        html_GetElement('f37_'+vRow).value =('&F101_QUOTE_LINE_ID.');  //< -- This does not work, the applicaiton item is blank!
          if (gReturn) {
           alert(gReturn);
          if(gReturn) {
           html_GetElement('f20_'+vRow).value = '';
           html_GetElement('f37_'+vRow).value = '';
       }  //End Check Length
      } else {
      html_GetElement('f37_'+vRow).value = '';
      } // is Link Line a number?   
    } // End If  
    } // End ValidateLinkLine
    </script>Edited by: blue72TA on Aug 16, 2011 11:39 AM
    Edited by: blue72TA on Aug 16, 2011 11:41 AM
    Edited by: blue72TA on Aug 16, 2011 11:41 AM

    Hi,
    When you use application item in JavaScript like you do, string &F101_QUOTE_LINE_ID. is substituted by item value from session state.
    Changes to that item value when you call On Demand process do not affect to page.
    Lets take example,
    You app item F101_QUOTE_LINE_ID value is e.g. XX in session state.
    You run page and see page source it looks like this
    html_GetElement('f37_'+vRow).value =('XX');Kind you have hard code value to JavaScript.
    Nothing will change that unless you refresh page.
    You need return value from On Demand process.
    To set value code could look like then
    html_GetElement('f37_'+vRow).value = gReturn;Regards,
    Jari

  • Trouble using Javascript getElementById

    hello,
    unfortunately the great comfort of studio creator2 ends, wenn using javascript. I alway debugged it using firefox, but that doesn't seem to work here:
    Document.getElementsById("form1:totalCostTextField").value =
            document.getElementsById("form1:cost1TextField").value+
            document.getElementsById("form1:cost2TextField").value+
            document.getElementsById("form1:cost3TextField").value+
            document.getElementsById("form1:cost4TextField").value+
            document.getElementsById("form1:cost5TextField").value+
            document.getElementsById("form1:cost6TextField").value;as you can see i've got a form of some textfields recieving prices and i have to calculate the total price. A perfect job for javascript i thought. At first i discoverd that i have to integrate the form-Name (form1 here) to the id i specified, as Creator seems to put it in front of the elements id. I also found out, that using readonly turns an inputfield to a span-tag ( why so ever); i turned off readonly therefore ( as the ID will be appended "_readOnly").
    Well my problem is, that the onBlur-Event IS called ( proved by a simple alert). But nothing will be calculated. Normally FireFoxes Javascript-Console will show any errors. In this case it doesn't. Where am i wrong here. Are my Identifiers incorrect? Why can't i see any recalculating ?
    thank you
    wegus

    Hmmm..
    some errors here.
    - The method you have to call is getElementById, without the 's'.
    - The first Document must be with a lowercase 'd'
    - In JavaScript you have to explicitly convert an input text to number with parseInt() if you want to make some calculation
    Therefore, if I understand what you want to do, for example define a javascript function like:
    function sumValues(){
         var temp1 = parseInt(document.getElementById("form1:cost1").value);
            if (isNaN(temp1)) return;
            var temp2 = parseInt(document.getElementById("form1:cost2").value);
            if (isNaN(temp2)) return;
            var temp3 = parseInt(document.getElementById("form1:cost3").value);
            if (isNaN(temp3)) return;
            document.getElementById("form1:totalCost").value = temp1+temp2+temp3;
    }then add the function call to each text field's onBlur event.
    Any time that a field will lost its focus, then the sum will be recalculated.
    Ciao,
    Fabio

  • How to display cascaded dropdownlist using MVC4?

    I have two tables in DB to populate cascading dropdownlist. On change of value in first dropdown, second dropdown has to be populated
    using second table. While i tried below code, i am getting the same data for country dropdownlist. countryid is primary key in country table and  it is
    foreign key in state table. First row country id in state table is 6 which corresponds to North America in country table. It displays the same for all 11 rows in country dropdownlist. Please give me right direction?
      public ActionResult Submit()
               List<Country> allcountry= new List<Country>();
               List<State> allstate = new List<State>();
               using (portalconnectionstring pc = new portalconnectionstring())
                    allcountry = pc.countries.OrderBy(a => a.countryname.ToList();
                ViewBag.CountryID = new SelectList(allcountry, "countryid", "countryname");
                ViewBag.StateID = new SelectList(allstate, "stateid", "statename");
                 return View();
                [HttpPost]
                [ValidateAntiForgeryToken]
    public ActionResult Submit(Feedback s) {
     List<Country> allcountry= new List<Country>();
     List<State> allstate= new List<State>();
     using (portalconnectionstring pc = new portalconnectionstring())
                   allcountry= pc.countries.OrderBy(a => a.countryname).ToList();
                   if (s != null && s.towerid > 0)
                        allstate= pc.states.Where(a => a.countryid.Equals(s.countryid)).OrderBy(a => a.statename).ToList();
     ViewBag.CountryID = new SelectList(allcountry, "countryid", "countryname", s.countryid);
              ViewBag.StateID = new SelectList(allstate, "stateid", "statename", s.stateid);
     if (ModelState.IsValid)
                        using (portalconnectionstring pc = new portalconnectionstring())
                            using (NpgsqlCommand pgsqlcommand = new NpgsqlCommand("ddltest", conn))
     pgsqlcommand.CommandType = CommandType.StoredProcedure;
     pgsqlcommand.Parameters.Add(new NpgsqlParameter("countryname", NpgsqlDbType.Varchar));
                            pgsqlcommand.Parameters.Add(new NpgsqlParameter("statename", NpgsqlDbType.Varchar));
      pgsqlcommand.Parameters[0].Value = model.countryname;
                            pgsqlcommand.Parameters[1].Value = model.statename;
     pgsqlcommand.ExecuteNonQuery();
                            ViewBag.Message = "Successfully submitted";
                    else
                        ViewBag.Message = "Failed! Please try again";
                    return View(s);
                [HttpGet]
                public JsonResult GetStates(string countryid = "")
                    List<State> allstate= new List<State>();
                    int ID = 0;
                    if (int.TryParse(countryid, out ID))
                        using (portalconnectionstring dc = new portalconnectionstring())
                            allstate = dc.states.Where(a => a.countryid.Equals(ID)).OrderBy(a => a.statename).ToList();
                    if (Request.IsAjaxRequest())
                        return new JsonResult
                            Data = allstate,
                            JsonRequestBehavior = JsonRequestBehavior.AllowGet
                    else
                        return new JsonResult
                            Data = "Not valid request",
                            JsonRequestBehavior = JsonRequestBehavior.AllowGet
    cshtml:
    @model mvcdemo.Models.Feedback
        ViewBag.Title = "Submit";
    <h2>Submit</h2>
    @using (Html.BeginForm("Submit","cascadedddl",FormMethod.Post)) {
        @Html.ValidationSummary(true)
        @Html.AntiForgeryToken()
        <fieldset>
            <legend>Feedback</legend>
     <div class="editor-label">
                @Html.LabelFor(model => model.countryid)
            </div>
            <div class="editor-field">
                 @Html.DropDownListFor(model => model.countryid,@ViewBag.CountryID as SelectList,"Select country")
                @Html.ValidationMessageFor(model => model.countryid)
            </div>
            <div class="editor-label">
                @Html.LabelFor(model => model.stateid)
            </div>
            <div class="editor-field">
                @Html.DropDownListFor(model => model.stateid, @ViewBag.StateID as SelectList, "Select state")
                @Html.ValidationMessageFor(model => model.stateid)
            </div>
     <p>
                <input type="submit" value="Create" />
            </p>
        </fieldset>
                    <script type="javascript">
                        $(document).ready(function () {
                            $("#countryid").change(function () {
                                var countryID = parseInt($("#countryid").val());
                                if (!isNaN(countryID)) {
                                    var ddstate = $("#stateid");
                                    ddstate.empty(); 
                                    ddstate.append($("<option></option").val("").html("Select State"));
                                    $.ajax({
                                        url: "@Url.Action("GetState","cascadedddl")",
                                        type: "GET",
                                        data: { countryID: countryid },
                                        dataType: "json",
                                        success: function (data) {
                                            $.each(data, function (i, val) {
                                                ddstate.append(
                                                        $("<option></option>").val(val.stateid).html(val.statename)
                                        error: function () {
                                            alert("Error!");
                    </script>

    Please post questions related to ASP.NET in the ASP.NET forums (http://forums.asp.net ).

  • Using Chart Annotation Element

    I have a rather strange issue which I just can't get my head around. Basically I have a function which looks like the below - This simply draws a box around half of the data canvas.
    private function draw():void
                    canvas.clear();
                    canvas.beginFill(0x62dce1);
                    var canvasWidth:Number = canvas.width;
                    var canvasHeight:Number = canvas.height;
                    var minPt:Array = canvas.localToData(new Point(0, 0));
                    var maxPt:Array = canvas.localToData(new Point(canvasWidth/2,canvasHeight));
                    canvas.drawRect(minPt[0]-1, maxPt[1], maxPt[0]-1, minPt[1]);
                    canvas.endFill();
    This works perfectly well when using data that is loaded locally - i.e. data that is stored within an array collection with the MXML file. However, the momeny I use a HTTP:Service to pull in the data, once the button is click to draw the rectangle - NOTHING appears on the data canvas.
    Does anyone know why this might be happening? Im assuming its something to do with the data canvas updating as soon as the chart is loaded and isn't waiting for the asyncronose HTTP service?
    Any ideas would be greatly appreciated.
    Thanks
    Full Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="getGoogleData.send()">
        <mx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
                import mx.collections.ArrayCollection;
                import mx.containers.HBox;
                  import mx.charts.LinearAxis;
                  import mx.containers.Box;
                import mx.collections.ArrayCollection;
                   import mx.charts.series.items.ColumnSeriesItem;
                import mx.charts.ChartItem;
                import mx.charts.chartClasses.CartesianCanvasValue;
                import mx.charts.chartClasses.CartesianTransform;
                 [Bindable]
                 public var profits:ArrayCollection = new ArrayCollection([
            {Month:1, Profit:1300},
            {Month:2, Profit:750},
            {Month:3, Profit:1100},
            {Month:4, Profit:1000},
            {Month:5, Profit:980},
            {Month:6, Profit:1500},
            {Month:7, Profit:2060},
            {Month:8, Profit:1700},
            {Month:9, Profit:1690},
            {Month:10, Profit:2200},
            {Month:11, Profit:2550},
            {Month:12, Profit:3000}
                [Bindable]
                private var summaryGoogleData:ArrayCollection = new ArrayCollection;
                [Bindable]
                public var folderLocation:String = "http://79.99.65.19/VISA/PHP";
                import mx.rpc.events.ResultEvent;
                private function recieveGoogleData(evt:ResultEvent):void
                    var tmpArray:Object = new Object;
                    tmpArray = evt.result.data.graphdata;
                    for each (var o : Object in tmpArray)
                        if (o.pagepath == "/bbva")
                            summaryGoogleData.addItem(o);
                    test.dataProvider = summaryGoogleData;
                public var drawnOnChart:Boolean = false;
                private function drawOnChart(evt:Event):void
                    if (drawnOnChart == false)
                        var p:Point = canvas.dataToLocal(10,600);
                        if (isNaN(p.x) || isNaN(p.y))
                            trace ("Nan");
                        else
                            trace ("Not NaN");
                            var x:Number = p.x;
                              var y:Number = p.y;
                              //drawSquareBox();       
                //updateComplete="drawOnChart(event)"
                 private function draw():void
                    canvas.clear();
                    canvas.beginFill(0x62dce1);
                    var canvasWidth:Number = canvas.width;
                    var canvasHeight:Number = canvas.height;
                    var minPt:Array = canvas.localToData(new Point(0, 0));
                    var maxPt:Array = canvas.localToData(new Point(canvasWidth/2,canvasHeight));
                    canvas.drawRect(minPt[0]-1, maxPt[1], maxPt[0]-1, minPt[1]);
                    canvas.endFill();
            ]]>
        </mx:Script>
        <!-- GET THE SUMMARY OF VISITS (GOOGLE) -->
        <mx:HTTPService id="getGoogleData" showBusyCursor="true" result="recieveGoogleData(event)" fault="getGoogleData.send()" method="GET" url="{folderLocation}/get_summaryGoogleData.php" useProxy="false"/>
        <mx:Legend dataProvider="{linechart1}" x="755" y="10"/>
        <mx:DataGrid x="357" y="315" id="test">
        </mx:DataGrid>
        <mx:Button x="52" y="323" label="Button" click="draw()"/>
        <mx:Panel x="10" y="10" width="830" height="265" layout="absolute">
            <mx:LineChart x="0" y="0" id="linechart1" height="222" width="800" dataProvider="{profits}">
                <mx:horizontalAxis>
                    <mx:CategoryAxis categoryField="Month"/>
                </mx:horizontalAxis>
                <mx:series>
                    <mx:LineSeries displayName="Series 1" yField="Profit"/>
                </mx:series>
                <mx:annotationElements>
                    <mx:CartesianDataCanvas alpha=".25" id="canvas" includeInRanges="true"  />
                </mx:annotationElements>
            </mx:LineChart>
        </mx:Panel>
    </mx:Application>

    I have a rather strange issue which I just can't get my head around. Basically I have a function which looks like the below - This simply draws a box around half of the data canvas.
    private function draw():void
                    canvas.clear();
                    canvas.beginFill(0x62dce1);
                    var canvasWidth:Number = canvas.width;
                    var canvasHeight:Number = canvas.height;
                    var minPt:Array = canvas.localToData(new Point(0, 0));
                    var maxPt:Array = canvas.localToData(new Point(canvasWidth/2,canvasHeight));
                    canvas.drawRect(minPt[0]-1, maxPt[1], maxPt[0]-1, minPt[1]);
                    canvas.endFill();
    This works perfectly well when using data that is loaded locally - i.e. data that is stored within an array collection with the MXML file. However, the momeny I use a HTTP:Service to pull in the data, once the button is click to draw the rectangle - NOTHING appears on the data canvas.
    Does anyone know why this might be happening? Im assuming its something to do with the data canvas updating as soon as the chart is loaded and isn't waiting for the asyncronose HTTP service?
    Any ideas would be greatly appreciated.
    Thanks
    Full Code:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" initialize="getGoogleData.send()">
        <mx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
                import mx.collections.ArrayCollection;
                import mx.containers.HBox;
                  import mx.charts.LinearAxis;
                  import mx.containers.Box;
                import mx.collections.ArrayCollection;
                   import mx.charts.series.items.ColumnSeriesItem;
                import mx.charts.ChartItem;
                import mx.charts.chartClasses.CartesianCanvasValue;
                import mx.charts.chartClasses.CartesianTransform;
                 [Bindable]
                 public var profits:ArrayCollection = new ArrayCollection([
            {Month:1, Profit:1300},
            {Month:2, Profit:750},
            {Month:3, Profit:1100},
            {Month:4, Profit:1000},
            {Month:5, Profit:980},
            {Month:6, Profit:1500},
            {Month:7, Profit:2060},
            {Month:8, Profit:1700},
            {Month:9, Profit:1690},
            {Month:10, Profit:2200},
            {Month:11, Profit:2550},
            {Month:12, Profit:3000}
                [Bindable]
                private var summaryGoogleData:ArrayCollection = new ArrayCollection;
                [Bindable]
                public var folderLocation:String = "http://79.99.65.19/VISA/PHP";
                import mx.rpc.events.ResultEvent;
                private function recieveGoogleData(evt:ResultEvent):void
                    var tmpArray:Object = new Object;
                    tmpArray = evt.result.data.graphdata;
                    for each (var o : Object in tmpArray)
                        if (o.pagepath == "/bbva")
                            summaryGoogleData.addItem(o);
                    test.dataProvider = summaryGoogleData;
                public var drawnOnChart:Boolean = false;
                private function drawOnChart(evt:Event):void
                    if (drawnOnChart == false)
                        var p:Point = canvas.dataToLocal(10,600);
                        if (isNaN(p.x) || isNaN(p.y))
                            trace ("Nan");
                        else
                            trace ("Not NaN");
                            var x:Number = p.x;
                              var y:Number = p.y;
                              //drawSquareBox();       
                //updateComplete="drawOnChart(event)"
                 private function draw():void
                    canvas.clear();
                    canvas.beginFill(0x62dce1);
                    var canvasWidth:Number = canvas.width;
                    var canvasHeight:Number = canvas.height;
                    var minPt:Array = canvas.localToData(new Point(0, 0));
                    var maxPt:Array = canvas.localToData(new Point(canvasWidth/2,canvasHeight));
                    canvas.drawRect(minPt[0]-1, maxPt[1], maxPt[0]-1, minPt[1]);
                    canvas.endFill();
            ]]>
        </mx:Script>
        <!-- GET THE SUMMARY OF VISITS (GOOGLE) -->
        <mx:HTTPService id="getGoogleData" showBusyCursor="true" result="recieveGoogleData(event)" fault="getGoogleData.send()" method="GET" url="{folderLocation}/get_summaryGoogleData.php" useProxy="false"/>
        <mx:Legend dataProvider="{linechart1}" x="755" y="10"/>
        <mx:DataGrid x="357" y="315" id="test">
        </mx:DataGrid>
        <mx:Button x="52" y="323" label="Button" click="draw()"/>
        <mx:Panel x="10" y="10" width="830" height="265" layout="absolute">
            <mx:LineChart x="0" y="0" id="linechart1" height="222" width="800" dataProvider="{profits}">
                <mx:horizontalAxis>
                    <mx:CategoryAxis categoryField="Month"/>
                </mx:horizontalAxis>
                <mx:series>
                    <mx:LineSeries displayName="Series 1" yField="Profit"/>
                </mx:series>
                <mx:annotationElements>
                    <mx:CartesianDataCanvas alpha=".25" id="canvas" includeInRanges="true"  />
                </mx:annotationElements>
            </mx:LineChart>
        </mx:Panel>
    </mx:Application>

  • IsNan() function

    Hi All,
    I would like to ask regarding the IsNan() function. How is it used and what is its output?
    I am using it in an if statement and cant seem to get a result. It only outputs #error in my report.
    I am using it in a matrix report which displays the percentage(%) calculation for project hours of a department.
    There might be where a department has no project hours clocked and I would like to output 0%
    Can anyone help?
    Thanks & Regards,
    Fadzli

    Hi Fadzli,
    The Double.ISNaN(Expression) method returns boolean value, which is True or False. True if the Expression evaluates to not a number; otherwise, false. For example, one expression of report definition language like this:  =Double.IsNaN(12.03) ,  which returns false.
    we often use the IsNumeric() function to evaluate an expression as a number. This function also returns a Boolean value indicating whether an expression can be evaluated as a number. For example, the expression: =IsNumeric(12.03)  , which returns true.
    If the above information still can’t help you, please POST what you want to do with the IsNan() in your report project and better with sample data.
    Regards,
    Jerry

Maybe you are looking for