Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2010
    Location
    New York City
    Posts
    220
    Post Likes

    niagara programming languages

    In Niagara AX , this(Below) program takes the values of two inputs ,adds them together and sends result to an output
    What programming language is this written in.
    The syntax does not exactly match the Java GET syntax.
    Doeswork bench or N4 have an online help for this language
    ************************
    public void onExecute() throws Exception
    {
    BStatusNumeric in1 = getIn1();
    BStatusNumeric in2 = getIn2();
    BStatusNumeric out = getOut();

    out.setValue( in1.getValue() + in2.getValue() );
    }

  2. #2
    Join Date
    Jan 2003
    Location
    USA
    Posts
    5,197
    Post Likes
    docDeveloper and also look at the help in WB, under API or baja.
    Propagating the formula. http://www.noagendashow.com/

  3. #3
    Join Date
    Jan 2015
    Location
    North Carolina
    Posts
    152
    Post Likes
    Java is just the language it’s written in. EVERYTHING in Niagara extends from BObject which is an extension of the Java Object.

    The Niagara framework is an extended version of Java, so many of its methods do not apply to anything outside of Niagara.

    In your example, in1, in2 and out are variables, with BStatusNumeric being the object type.

    GetIn1 and GetIn2 are your get method’s for the in slots and GetOut() is your get method for the out slot. These methods resolve the slot. They basically go out and validate that there is a slot called In1 or In2, etc.

    getValue() is the method used to access the values stored in the “in” slots.

    setValue() is the method used to set a value of a slot.

    If you open up help in Workbench and search for “BStatusNumeric”, you’ll find the Baja Doc for BStatusNumeric and you’ll find the get() and set() methods there.

    The following code will do the exact same thing as what you posted, given you have slots in1, in2 and out of type BStatusNumeric, configured in the slot sheet of the program object.

    //
    BDouble x = getIn1().getValue();
    BDouble y = getIn2().getValue();
    BDouble z = x + y;

    getOut().setValue(z);
    //
    getIn1() resolves the object, getValue() accesses the value stored in the object.

    BDouble is the object type that the value is stored as.

    Also, given that you code is from a program object, onExecute is the method that is fired on execute. This means that if your in1 or in2 slots have the “execute” flag checked, any time one of those values change, onExecute will fire. If they don’t have the execute flag checked, it will only fire when you right click and manually invoke the “Execute” action.

    I hope this helps. The Program Object is awesome, but throws lots of curves at you.

  4. #4
    Join Date
    Feb 2010
    Location
    New York City
    Posts
    220
    Post Likes
    Thread Starter
    I appreciate it synyster.
    My programming language is limited
    To Visual Basic and JavaScript
    I am familiar with the get and Set methods, and that
    The program is declaring variables
    My problem is syntax.
    When I study a language I need to know the proper syntax
    A word always followed by a coma here an etc.
    When I see something with familiar statements, but in a syntax I am not familiar with, it throws me off.
    I gather Bobject is a Baja Object.

  5. #5
    Join Date
    Jan 2015
    Location
    North Carolina
    Posts
    152
    Post Likes
    Niagara pretty much follows Java standards, in regards to syntax and semantics. I struggled starting out because I was learning it backwards. I really didn't know Java or truly understand OOP, but when I eventually put some effort into learning core Java, alot of things started making sense.

    I created a station in AX with a bunch of program objects that do random things and I included notes describing what does what in the code. I can send it to you if you'd like.

  6. #6
    Join Date
    Feb 2010
    Location
    New York City
    Posts
    220
    Post Likes
    Thread Starter
    Yes ,Please do send any programs you have.
    Niagara does not use the Standard Java language
    For writing programs?
    Thank you

  7. #7
    Join Date
    Jan 2015
    Location
    North Carolina
    Posts
    152
    Post Likes
    Quote Originally Posted by techservices View Post
    Niagara does not use the Standard Java language
    For writing programs?
    It does, but it probably doesn't look familiar to you because Java objects in Niagara have their own methods. I can assure you that the same syntax and semantic rules in place for Java apply to Niagara.
    Every statement ends with a semicolon, Niagara uses the same operators, type casting, method overloading, etc as Java. Where I think you are getting caught up in is how you interact with objects. You have to use the methods provided to interact with Niagara objects.

  8. #8
    Join Date
    Sep 2007
    Location
    Kenilworth NJ
    Posts
    1,906
    Post Likes
    Quote Originally Posted by Synyster View Post
    I created a station in AX with a bunch of program objects that do random things and I included notes describing what does what in the code. I can send it to you if you'd like.
    I would really.like a copy as well. I have been getting around to looking at Niagara style Java for a while. Email is in my profile
    Hmmmm....smells like numbatwo to me.

  9. #9
    Join Date
    Dec 2007
    Location
    Connecticut
    Posts
    1,162
    Post Likes
    Quote Originally Posted by Synyster View Post
    Niagara pretty much follows Java standards, in regards to syntax and semantics. I struggled starting out because I was learning it backwards. I really didn't know Java or truly understand OOP, but when I eventually put some effort into learning core Java, alot of things started making sense.

    I created a station in AX with a bunch of program objects that do random things and I included notes describing what does what in the code. I can send it to you if you'd like.
    Could you send it my way as well please? Thank You!

  10. #10
    Join Date
    Mar 2018
    Posts
    181
    Post Likes
    I take it learning more about JAVA language would help with understanding all the options in BQL queries?



    Sent from my iPhone using Tapatalk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Contracting Business
HPAC Engineering
EC&M
CONTRACTOR