Community
Showing results for 
Search instead for 
Do you mean 
Reply

My table in ACT

Tuned Listener
Posts: 21
Country: Germany

My table in ACT

Hello all,

 

for my plugin i need to save some of parameters. Can I to create a table in ACT! DB for saving parameters?

 

Thanks,

Alex

Copper Contributor
Posts: 42
Country: Germany

Re: My table in ACT

Hi,

 

There are several solutions for saving parameters depending on on what kind of parameters you like to store. Is it per ACT-Contact, per User or per Organisation (same settings for all users)?

 

In all cases, I would not manually create tables within the ACT-Database (e.g. by SQL Server Management Studio) as this could theoretically break future updates (although I think this is very unlikely to happen).

But even if you did so, there is no way of accessing this table through the ACT-SDK (as far as I know) so you would have to access it with your an separate SQL-Connection which you could also use to access the table in another database. So I think there is no benefit (besides having the plugin data saved with the ACT-Backup) in storing the table inside the ACT-Database.

What you could do:

  1. add a second Database to the ACT-Database server storing your settings
  2. add a .XML-File with your settings to the ACT-Share
  3. add a .XML-File with your settings to the user-profile

I am using method 2, here's an example for reading settings from the .XML-File if it's located in a newly created "Config" folder on the ACT-FileShare

 

public static string GetAppSetting(string strKey)
{
 System.Configuration.Configuration cfg=System.Configuration.ConfigurationManager.OpenExeConfiguration("\\\\"+Act.UI.ActApplication.Instance.ActFramework.ActDatabase.Machine.ToString().Split('\\')[0]+"\\"+Act.UI.ActApplication.Instance.ActFramework.CurrentDatabase.ToString()+"-database files\\Config\\"+System.Reflection.Assembly.GetExecutingAssembly().ManifestModule.Name);
 System.Configuration.KeyValueConfigurationElement ele=cfg.AppSettings.Settings[strKey];
 if(ele!=null)
 {
  string value=ele.Value;
  if(!string.IsNullOrEmpty(value))
   return value;
 }
 return string.Empty;
}

 

 The .XML-File could look like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <appSettings>
  <add key="key-name" value="value-data"/>
 </appSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1"/></startup></configuration>

 

Copper Super Contributor
Posts: 86
Country: United_Kingdom

Re: My table in ACT

Hi Janus,

 

The Act! SDK does not support creating tables, only sub-entities.

 

The following post has a working example of sub-entities that should get you started in the right direction.

 

http://community.act.com/t5/Act-Developer-Downloads/Custom-Sub-Entity-Visual-Studio-Template/td-p/11...

 

Kind regards,

 

Sam.

____________________________________________________________

Unfortunately I no longer work for Swiftpage International. Please do not send any queries to this account.