Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

Script Classes in FrameworkX are custom methods that can be called from Tasks, Expressions or Displays. Written in C#, VB.NET, or Python, these classes enable users to develop functionalities that can be  used multiple times throughout the soluiton.

On this page:

Table of Contents
maxLevel3

Configuring Classes

Classes let you

ScriptClasses allow you to create a repository of class libraries, methods, and functions that you can use across the application. You can call them from tasks, other classes, and

displays (

the display's code behind

)

functionality.  

On this page:

Table of Contents
maxLevel3
stylenone

Tip
titleSolution Example

Scripts Examples



Image Added

Configuring ScriptClasses

To create and configure a new ScriptClass follow the steps below:

  1. Access Scripts → Classes

  2. Click on the plus icon.

  3. Input a class name and description, select the desired language and choose the domain of the class.

  4. Choose to either create a new code or import one from an existing library.

  5. Choose the content type for the class.

  6. Click Ok.

Now, you can double-click the newly created row to access the Code Editor, where you can insert the code for the ScriptClass.

Info

To edit a property of an existing object, click the desired property to select it and click it again after a second to edit it. See a list of available properties in the next section.

The image below illustrates the process described above.
Image Added

Built-in ScriptClasses

All solutions include the following built-in ScriptClasses:

  • ServerMain: The methods library available for all server tasks.
  • ClientMain: The methods library available for all clients.
 

ScriptClasses Configuration Tables

The following is a table describing each available property field for ScriptClasses:

Property

Description

Name

The name of the class.

Code

Specifies the language used for the code of this Class

FactoryStudio comes with the following built-in classes:

  • ServerMain—Methods library available for all server tasks.
  • ClientMain—Methods library available for all clients.

To configure classes:

  • Go to Scripts > Classes.
  • Select a class name, or select the insert row (first row) to create a new class.
  • Enter or select information, as needed.
  • Then you can double-click on the row created to go to Code Editor.

Column

Description

Name

Enter a name for the class. The system lets you know if the name is not valid.

Code

Read-only. This specifies the language used for the code for this task

. By default, this is the language you selected when you created the

project. From the Code Editor tab, you can change the code language. To change the project default, go to Info > Settings

solution.

Domain

Select

The location where the class executes, there are two options:

Client—Class executes
  • Client: The class is executed on each client system. These are classes that apply locally (on the user's computer)
. For example, report generation
  • .
Server—Class executes
  • Server: The class is executed on the server system. These are classes that apply globally across the
application, that is, globally.|

Content

  • solution.

ClassContent

The

Read-only. Show the

type of the content in the class (

i.e.: method or namespace

Methods or Namespace)

EditSecurity

Edit Security

Set the

The security to enable who can edit the tasks.

BuildOrder

Build Order

Set the

The order to build the classes.

BuildStatus

Build Status

The

Read-only.

Status of the class code from the continuous compiling process.

  • Green check
mark—Class
  • mark: The task runs without errors.
  • Red
X—Class
  • X: The task has warnings or errors
. Double
  • , double-click to
go to
  • access the warning or error.
    • Warnings are information only.
    • Errors will prevent the code from running for that specific
class
    • task. The rest of the
application
    • solution will run.
|Read-only.

BuildErrors

Build Errors

Displays any errors encountered during the last build.

Description

Enter a

The description of this class.

[Other columns]For definitions of other columns that are available in this table, see Common Column Definitions.
    • Apply all namespaces that will be used in your code, e.g.
      • “Using System”
      • “System.IO.StremReader”
    • Click Save.
 



Circular References

A circular reference occurs when two classes mutually depend on each other. For example:

  • Class A has methods or attributes that reference Class B.
  • Class B, in turn, has methods or attributes that reference Class A.

This structure creates a “circularity” between the classes, leading to compilation failures and complicating code maintenance.

How Compilation Caching Works with Circular References:

  • When Saving a Class Individually: When a class (e.g., Class A) is saved, the system caches the last successfully compiled version. Therefore, if Class B references Class A, and Class A is then altered in a way that causes a compilation error, this error may not immediately appear in Class B because the cache retains the last valid version.

  • During a Complete Solution Build: During a full build, the cache is cleared, and all classes are recompiled from scratch. In this process:

    • If there are circular references and one of the classes contains a compilation error, none of the classes will compile successfully. To resolve this, one of the circular references should be temporarily removed (commented out or deleted), allowing the successful compilation of one of the classes by saving. Then, the removed reference can be reinserted in the other class, now correctly compiled.


Note

We emphasize that using circular references is not a recommended practice. This kind of mutual dependency compromises code stability and maintainability, complicates debugging, and leads to complete build failures.


Recommendations:

  • Guide users to avoid circular references between classes whenever possible, as this will simplify compilation and maintenance.
  • Include an explanatory note that, while the system does not block the creation of circular references, this practice is not recommended, as it often leads to compilation difficulties and stability issues.

In this section:

In this section...

Page Tree
root@parent
spacesV10