Skip to main content
Cadet | Tier 2
September 28, 2022
Question

How to instantiate a Table in IntelliJ when building your own package

  • September 28, 2022
  • 4 replies
  • 205 views

I am building a package which accept a Table as input. Package is working great now but took me a while to make it run properly mainly due to the fact that I could not figure out how to instantiate a Table within IntelliJ. SO had to build and install package in our control room, do some testing and go back to IntelliJ until successful. Not the best approach.

Is there an example or documentation on what would be needed to instantiate an AA Table within IntelliJ. I figured out that Table is also making use of a schema instance which appears to be the column definition including type.

Any help would be appreciated. Thanks

    4 replies

    Ashwin A.K
    Navigator | Tier 3
    September 29, 2022

    Hi @Rock Morin​ ,

     

    Could you give this a try?

    I found it on the Automation Anywhere GitHub page.

     

    TableValue tableValue= new TableValue(); //AA table variable

    Table table = new Table(); //normal table

    .

    //Add items to column schema

    List<Schema> schemas = new ArrayList<Schema>();

    for (Iteratoriterator = arrayWithColumnNames.getValues().iterator(); iterator.hasNext();)

    {

    StringValueheader = (StringValue) iterator.next();

    Schema schema = new Schema();

    schema.setName(header.get());

    schemas.add(schema);

    }

    table.setSchema(schemas);

    tableValue.set(table);

     

    Kind Regards,

    Ashwin A.K

    .

    Blogs at TheCodingTheory - https://www.thecodingtheory.com
    Rock 9762Author
    Cadet | Tier 2
    September 29, 2022

    Getting closer. I am getting an error instantiating the schema. The code compile but error is at runtime on this line:

    Schema schema = new Schema();

     

    I do have the following import:

    import com.automationanywhere.botcommand.data.model.Schema;

     

    The error I get is as follow:

    Caused by: java.lang.ClassNotFoundException: com.automationanywhere.botcore.api.dto.AttributeType

    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)

    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)

    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)

     

    This happens both in my test class and the bot action class

    Cadet | Tier 2
    November 13, 2023

    Getting same error as @Rock 9762 when trying to create a Schema object. Has anyone figured this one out?

    Cadet | Tier 2
    November 16, 2023

    Figured this one out. It appears you need to use newer AA360 SDK to create a Schema object, since the class was not provided in the earlier versions (i.e. 2.5.0). With 2.9.0 it works fine.