Topic
18 replies Latest Post - ‏2012-12-18T14:53:57Z by SystemAdmin
Sujita
Sujita
44 Posts
ACCEPTED ANSWER

Pinned topic Automation script error in Maximo v7.5

‏2012-12-14T06:12:42Z |
Hi,

In Maximo v7.5, automation scripts i am not able to call any variable in the source code of the script. i have attached the doc which i followed in maximo v7.5. Please help me if anyone knows about this.

Thanks in advance

Regards,
Sujitha
Updated on 2012-12-18T14:53:57Z at 2012-12-18T14:53:57Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    5842 Posts
    ACCEPTED ANSWER

    Re: Automation script error in Maximo v7.5

    ‏2012-12-14T09:01:29Z  in response to Sujita
    Hi,

    I have tested your script and it works fine.

    Two points.

    1. while creating variables check Suppress Access Control? checkbox
    2. Jython is strict on indentation. Follow below indentation

    if totalcost >= 100:
    purchagent_required=True
    Hope this will help.

    Cheers,

    Prashant Karamadi
  • SystemAdmin
    SystemAdmin
    5842 Posts
    ACCEPTED ANSWER

    Re: Automation script error in Maximo v7.5

    ‏2012-12-14T09:03:25Z  in response to Sujita
    I have noticed in my previous reply code indentation is removed. Please indent your code.
  • SystemAdmin
    SystemAdmin
    5842 Posts
    ACCEPTED ANSWER

    Re: Automation script error in Maximo v7.5

    ‏2012-12-14T09:06:00Z  in response to Sujita
    what error it is giving ...?
    Is it allowing to save the script....if there are any indent error then it will not allow to save you...

    But if there are any thing else on binding then you can set the logger for auto script..and debug the error...

    Regards
    Sudipto
    • Sujita
      Sujita
      44 Posts
      ACCEPTED ANSWER

      Re: Automation script error in Maximo v7.5

      ‏2012-12-14T11:15:53Z  in response to SystemAdmin
      Hello,

      Thanks for your reply. Following are the code,
      if totalcost >= 100:
      purchagent_required=True
      How to indent my code, i am getting error like as below
      "SyntaxError: mismatched input 'purchagent_required' expecting INDENT in <script> at line number 2 at column number 0"

      I have checked the supress access control check box.

      Regards,
      Sujitha
      • SystemAdmin
        SystemAdmin
        5842 Posts
        ACCEPTED ANSWER

        Re: Automation script error in Maximo v7.5

        ‏2012-12-14T11:22:20Z  in response to Sujita
        Hi Sujita,

        INDENT error because of bad syntax..

        please check once

        jython is sensitive on tab spaces for nested if/else statements
        so when u try to use Jython script - please make sure u have the tab spaces for the nested if else statements.
  • SystemAdmin
    SystemAdmin
    5842 Posts
    ACCEPTED ANSWER

    Re: Automation script error in Maximo v7.5

    ‏2012-12-14T11:31:42Z  in response to Sujita
    Try to Build a script in Eclipse python to avoid syntax(INDENT) errors.
    I tested this script it working fine.
  • SystemAdmin
    SystemAdmin
    5842 Posts
    ACCEPTED ANSWER

    Re: Automation script error in Maximo v7.5

    ‏2012-12-14T12:03:44Z  in response to Sujita
    PLZ find the attachment then u can identify what ur making wrong
  • SystemAdmin
    SystemAdmin
    5842 Posts
    ACCEPTED ANSWER

    Re: Automation script error in Maximo v7.5

    ‏2012-12-14T12:22:20Z  in response to Sujita
    If we write code like this
    if totalcost >= 100:
    purchagent_required=True
    we get an error
    SyntaxError: mismatched input 'purchagent_required' expecting INDENT in <script> at line number 2 at column number 0"
    To avoid this write code as below

    if TOTALCOST >=100:
    purchagent_required=True
    else:
    purchagent_required=False

    Because Tab spaces are very important in Jython scripting

    Good Luck............
    • SystemAdmin
      SystemAdmin
      5842 Posts
      ACCEPTED ANSWER

      Re: Automation script error in Maximo v7.5

      ‏2012-12-14T14:02:46Z  in response to SystemAdmin
      Hi sujitas,

      In JYTHON when you use IF statement,
      then dont writhe the next line exactly below to the IF...give a TAB space..And then try to save
      • Bowser
        Bowser
        79 Posts
        ACCEPTED ANSWER

        Re: Automation script error in Maximo v7.5

        ‏2012-12-14T17:50:23Z  in response to SystemAdmin
        On the topic of tabs and spaces, it should be noted that they are treated equally:

        1 tab = 1 space
        That matters because:
        1) Most code editors can be configured to put in spaces instead of a tab character. This feature tends to be off by default.
        2) Most code editors allow you to configure how many "spaces" a tab is worth. The default is often 4.
        3) Most code editors have an "auto-indent" feature that makes new lines start with the same indentation level as the last line. BUT some will use, for example, 2 tabs for the new line when you used 8 spaces for the last one -- causing problems for Python coders. (You see, 2 tabs of "white space" and 8 spaces of "white space" are not the same number of characters of "white space"!)

        So, if you get an "INDENT" or "OUTDENT" error, the FIRST thing you do is a global, regular-expression search for "\t" (the tab character) and replace with " " (4 spaces). THEN double check your editor's settings to ensure you have it configured to replace tabs with spaces (you might have to specify this behaviour *for the Python file type*) and that your tabs are worth 4 spaces.

        Bowser.
        • Sujita
          Sujita
          44 Posts
          ACCEPTED ANSWER

          Re: Automation script error in Maximo v7.5

          ‏2012-12-18T06:32:20Z  in response to Bowser
          Hello,

          Now if i try with the following code,
          if totalcost >=100:
          purchagent_required=True
          else:
          purchagent_required=False

          when i execute this, i am getting error like this as below,
          Traceback (most recent call last):
          File "<iostream>", line 1, in <module>
          NameError: name 'totalcost' is not defined

          I have define the variable already in the variable launch point at the time of creation of the script.

          Give me your suggestion on this.

          Regards,
          Sujitha
          • SystemAdmin
            SystemAdmin
            5842 Posts
            ACCEPTED ANSWER

            Re: Automation script error in Maximo v7.5

            ‏2012-12-18T10:22:24Z  in response to Sujita
            Hi sujitha,

            Are you able to save your code after formatting the indent error..?
            If yes then check the functionality if your code is working ...

            The name error you described always give when you run the script...
            Not sure why it gives..but it has nothing to do with your code...

            If you can save.then thats all...

            Regards
            Sudipto
            • Sujita
              Sujita
              44 Posts
              ACCEPTED ANSWER

              Re: Automation script error in Maximo v7.5

              ‏2012-12-18T10:47:01Z  in response to SystemAdmin
              Hi,

              Yes i am able to save my code without any error. But in the execution time, in the stderr section i am getting the error.Please see the attchment.

              Regards,
              Sujitha
              • SystemAdmin
                SystemAdmin
                5842 Posts
                ACCEPTED ANSWER

                Re: Automation script error in Maximo v7.5

                ‏2012-12-18T11:15:07Z  in response to Sujita
                Hi sujitha,

                As said before if you can save your code it means your syntex is correct;
                Now go in PR and check whether your script is getting executed...

                I always got the error of your screen shot...but it has nothing to do with your script...

                Regards
                Sudipto
                • Sujita
                  Sujita
                  44 Posts
                  ACCEPTED ANSWER

                  Re: Automation script error in Maximo v7.5

                  ‏2012-12-18T12:41:02Z  in response to SystemAdmin
                  Hello,

                  Script is working finally :) Thanks for all the replies.
                  Regards,
                  Sujitha
                  • SystemAdmin
                    SystemAdmin
                    5842 Posts
                    ACCEPTED ANSWER

                    Re: Automation script error in Maximo v7.5

                    ‏2012-12-18T12:51:44Z  in response to Sujita
                    Good job...

                    sudipto
                    • Sujita
                      Sujita
                      44 Posts
                      ACCEPTED ANSWER

                      Re: Automation script error in Maximo v7.5

                      ‏2012-12-18T12:57:57Z  in response to SystemAdmin
                      Hello Sudipto,

                      whenever we are creating duplicate SR (based on some field validation like asstnum, status) system needs to throw an error that this SR is already exixt. Now i need to achieve this through automation script. can anyone help me out the script in this.

                      Thanks and Regards,
                      Sujitha
                      • SystemAdmin
                        SystemAdmin
                        5842 Posts
                        ACCEPTED ANSWER

                        Re: Automation script error in Maximo v7.5

                        ‏2012-12-18T14:53:57Z  in response to Sujita
                        Hi Sujitha,

                        if i understand properly you wil duplicate a SR,then when you will try to save system will throw an exception if the record already exist...

                        So could you please give the screenshot of maximo where are duplicating...and you want to throw the exception...

                        and you can reach me at sudipto.saha752@gmail.com when you are heading specific...

                        regards
                        Sudipto