slimskism

MrPLC Member
  • Content count

    6
  • Joined

  • Last visited

Community Reputation

4 Neutral

About slimskism

  • Rank
    Newbie

Profile Information

  • Country Australia
  1. Citect Cicode database write line length restriction

    Good to hear you got it sorted.  Will have to keep that in mind for when we upgrade to the latest version.
  2. Citect Cicode database write line length restriction

    Yeah the d and s are just part of our naming convention that has s for string, d for dateTime, i for Int etc.  All of those are just variable names for information we want to store.  In your case you could just use something like @tagval1 , @tagval2 etc. but it might help to name them something more descriptive if you have to line them up with a particular column in your SQL database.
  3. Citect Cicode database write line length restriction

    The gsPrimaryConnection is an SQL connection string, see example below, you will need to replace SERVERNAME etc with your details: STRING gsPrimaryConnection = "Driver={SQL Server};Server=SERVERNAME;UID=USERNAME;Pwd=PASSWORD;Persist Security Info=True;Database=SQLDATABASENAME"; CSV_DB_Execute is a built in Cicode function (at least in 2015 SP1 that we are using).  There is some info for it here:  https://gcsresource.aveva.com/Citect/WebHelp/citect750sp1/default.htm#CSV_DB_Execute.html?Highlight=csv_db_execute qryInsertOperatorLog is the custom SQL script that I have shown above.
  4. Citect Cicode database write line length restriction

    Below is the important part of the Cicode file (I have taken part 3 and 4 out for the sake of brevity): // Connect to the database and log the action // The data is sent in 4 parts due to string size being greater then 255 // The 4 parts are User info, Tag Info, Comments and Computer info //Part 1 User info, (Date and user name) sCmd = "qryInsertOperatorLog"; sCmd = sCmd + "('" + sDateTime + "', '" + sUser +"', '"+ sPCNode +"')"; hRecordSet = CSV_DB_Execute(sCmd, gsPrimaryConnection); TraceMsg("Executing " + sCmd); IF hRecordSet = -1 THEN //Message("ERROR", "There was a problem creating a new operator log entry in function 'WriteSQL()'.",48); DBLogError("WriteSQL/SQLExec", hRecordSet, 0); CSV_DB_Close(hRecordSet); RETURN; END CSV_DB_Close(hRecordSet); //Part 2 Tag Info, (Action taken, tag name, new value) sCmd = "qryUpdateOpLogTagInfo"; sCmd = sCmd + "('" + sDateTime + "', '" + sAction + "', '" + sTag + "', '" + sValue + "', '"+ sPCNode +"')"; hRecordSet = CSV_DB_Execute(sCmd, gsPrimaryConnection); TraceMsg("Executing " + sCmd); IF hRecordSet = -1 THEN //Message("ERROR", "There was a problem creating a new operator log entry in function 'WriteSQL()'.",48); DBLogError("WriteSQL/SQLExec", hRecordSet, 0); CSV_DB_Close(hRecordSet); RETURN; END CSV_DB_Close(hRecordSet); This is the custom SQL scripts that exist on the server (insert, part1 and update, part2): ALTER PROCEDURE [dbo].[qryInsertOperatorLog] (@dEventTime AS datetime, @sUser AS nvarchar(20), @sPCNode AS nvarchar(50) ) AS BEGIN SET NOCOUNT ON; INSERT INTO [dbo].[OperatorLog] ([EventTime],[Operator],[PCNode]) VALUES (@dEventTime, @sUser, @sPCNode) END ALTER PROCEDURE [dbo].[qryUpdateOpLogTagInfo] (@dEventTime as datetime, @sAction nvarchar(30), @sTag nvarchar(79), @rValue real,@sPCNode AS nvarchar(50)) AS BEGIN SET NOCOUNT ON; UPDATE [dbo].[OperatorLog] SET [Action] = @sAction, [Tag] = @sTag, [Value] = @rValue WHERE ([EventTime] = @dEventTime) AND ([pcNODE] = @sPCNode) END Hope that helps, but let me know if you have any questions.
  5. Citect Cicode database write line length restriction

    Our system does something very similar to what you are doing.  I didn't the write the code to do it, but they got around the issue by writing some of the tags (and creating a new row in the SQL database), then updating that row with some more tags, on so on until all your tags are written.  It required a custom SQL script on the server for each time the tags were written.  I'll have a dig through the code and see if I can paste an example.
  6. How to share Citect Variable TAG??

    Are you using Citect on all the connected PLCs?  If you are, you should be able to run them as clients and view the tag values that way.  If you just want to view a file with the tag values, I'm not sure of a way to do that, but hoping someone else can help as I would like to know too.