Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4291 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi all,

i have a script that I want to use on four different TO's and as part of the script the Table Name is set up as a variable.This works fine if I am working on either all records or just the current record but In part of the script I want to perform a find, the same one in each table, and then perform an operation on this found set. Can the variable $Table_Name be used at all to accomplish the table portion of the Set Field step

Posted

Hi doughemi,

I have received your reply via email but it is not showing on here yet for some reason. I I can do that it will be great, I can use one script instead of four. When I try it I get an error message 106 saying "The Table Is Missing". Here is the script.

 

Create_Log_Records_Found_Set


# **********************************


# Creates the log records from records that have been created today


# **********************************


#


# Set up some variables


#


Set Variable [ $Table; Value:Get ( LayoutTableName ) ]

Set Variable [ $PK; Value:Case ( $Table="Clients" ; Clients::Client_No; $Table="Contact_Data" ; Contact_Data::Client_No ; $Table="Installation_Items";Installation_Items::Inst_No;$Table="Service_Items";Service_Items::Job_No;"" ) ]

Set Variable [ $Current_Date; Value:Get ( CurrentDate ) ]

# #Gives error message if Audit Data is attempted on layouts that are not set up for audits # If [ $Table ≠ "Clients" and $Table ≠ "Contact_Data" and $Table ≠ "Installation_Items" and $Table ≠ "Service_Items" ]

Show Custom Dialog [ Title: "Error!"; Message: "Only Clients, Installation_Items, Contact_Data and Service_Items have audit logs setup at this point. Edit the script 'Create Log Records' when you have set up others."; Buttons: “OK” ]


Halt Script End If


# # Now get the appropriate log records # IMPORTANT: Name the log field "_TableName_Audit_Log" and name the layout with the log field on it "COPYLOG_TableName"

#

Go to Layout [ "COPYLOG_" & $Table ]

Enter Find Mode [ ]

Set Field By Name [ "$Table::Date_Created"; $Current_Date ]

Perform Find [ ]

Copy All Records/Requests

 

# # Go to the main log layout and paste and create records

#

Go to Layout [ “AuditLog_Master” (AuditLog_Master) ]

Set Field [ AuditLog_Master::Audit_Log; "¶¶" ]

Paste [ AuditLog_Master::Audit_Log ]

Commit Records/Requests[ Skip data entry validation; No dialog ]

Set Field [ AuditLog_Master::Audit_Log; ¶ & Substitute ( AuditLog_Master::Audit_Log ; "^^" ; ¶ ) ]


# # Just creating new records will put all the right data into the right fields and remove one line from the global field

#

Loop

Exit Loop If [ IsEmpty( AuditLog_Master::Audit_Log ) ]

New Record/Request End Loop


# # Delete last record if it's blank # If [ IsEmpty( AuditLog_Master::Log_Table) ]


Delete Record/Request


[ No dialog ]


End If

Posted

Set Field By Name [ $Table & "::Date_Created"; $Current_Date ]

 

But why don't you just auto-enter the date when you create the record?

Posted

You really are going around Jack Robinson's barn to do this.  How many fields are you trying to log? How many log tables are you filling? Please describe the business objective involved, because your solution to it is convoluted, to say the least.

Posted

Hi doughemi,

The date is auto entered on creation, this is for a Find script.

The point of this is to extract the audit log data of records created on the current date over four tables and send it to the master audit log which in turn is exported to a totally separate database. The number of fields varies with each table. The reason for extracting the audit log data is twofold, firstly, in using Superlog, you accept that the audit data is transient, if the record is deleted then so is the audit data, secondly the the data is not presented in a manner that is easy to read nor compare so putting it in a usable, searchable table makes sense. The reason for wanting to script an autorun for it is that the log creation is very heavy on the system so I want to run it often rather than have the system unusable for twenty minutes.

This topic is 4291 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.