[Manifold-l] Active Columns in C# (also for Atelier)

Juan Pedro Pérez jp.alcantara at geo-st.com
Wed Sep 13 12:09:50 CDT 2006


Hello,

trying to help with the question of Atelier I tried to program my first 
C# Active Column. Recently I switched from VB.NET to C# due to my 
integration in a team where this is the language of choice. I have 
programmed dozens of VB.NET Active Columns, but the following C# code 
doesn't work to me:

using Manifold.Interop.Scripts;

class Script{
    static object Func() {
        return (Context.Record.get_Data("A") + 
Context.Record.get_Data("B"));
    }
}

the debugger returns that the + operator cannot be used with Object 
types. By the way, A and B are int types. With string types I was able 
to concatenate them using Context.Record.get_Data("AT").ToString(), but 
I'm totally lost about what's happening with numbers.

Atelier:

Yes, you have to write a script to operate with columns and store the 
result in an Active Column. It's easy with VB.NET:

Imports Manifold.Interop.Scripts

Class Script
    Shared Function DistritoSeccion

        Return Context.Record.Data("Column Name A") + 
Context.Record.Data("Column Name B")

    End Function
End Class

You reference the content of a column by using the "formula" 
"Context.Record.Data("Column name")". You can freely operate 
mathematically with them, but pay attention to the data type of the 
column (you can have problems if you try to sum a number to a letter, 
for example. However, VB.NET is rather permissive if that letter happens 
to be a number). The "Return" keyword signs that that is what you want 
to put in the Active Column. Hope this helps.

Greetings,
Juan Pedro Pérez



More information about the Manifold-l mailing list