TIA SCL: #ifdef like

22 views Asked by At

Is there a way in TIA SCL to implement compiler conditional like #ifdef?

I have projects-wide master library use in all my projects. As not all projects use all functionality within the same function (FB/FC), some projects do not include all DBs used in the master function. I wish like to implement project constants tags in order to switch On/Off parts of the code from the compiler.

Sample of useability to switch on or off part of global code based on project configuration, if we had directives control like #ifdef / #endif:

#ifdef 'Object_Type_A_EXIST'
    FOR #IDX := 1 TO "Object_Type_A".Max_Objects DO
        "Object_Type_CTRL"(ID := "Object_Type_A".OBJ[#IDX].ID);
    END_FOR;
#endif

#ifdef 'Object_Type_B_EXIST'
    FOR #IDX := 1 TO "Object_Type_B".Max_Objects DO
        "Object_Type_CTRL"(ID := "Object_Type_B".OBJ[#IDX].ID);
    END_FOR;
#endif
0

There are 0 answers