using global variables

  • 157 Views
  • Last Post 22 December 2017
  • Topic Is Solved
cristian ascencio posted this 18 December 2017

Hello,

Lately we´ve been building a definition with several  script rules inside. Most of them work with external datasource connection strings to the same  db. My question is:  ¿does flexicapture allows or supports somehow using global variables (for the connection string for example) wich could be used by any rule?

 

Thanks  anyone for the help!

Order By: Standard | Newest | Votes
Ekaterina posted this 20 December 2017

Hello,

Please use the Environment variable for this purpose. More details about it you may see in the “Environment variables” article in the Developer Help

cristian ascencio posted this 20 December 2017

Hi.. thank you for taking the time to answering..

 i createad an ADO string connection EV. (as you can see in the attached image) 

 but. i´m kinda newby on this  so i haven´t been able to call that EV in my script rule .. 

 i would be very thankful with you if you could take a look to  the attached file where i explain how i am actually connecting to my data source. the idea is to " replace" all that connection parameters  with the  EV. i just dont get how to do it.

 

Thank you for your help!

Attached Files

Ekaterina posted this 21 December 2017

Hello,

The Environment Variables are also available on the level of IProject, so you may call them as

var testCon = FCTools.ScriptContext.Project.EnvironmentVariables.Get("test_con");

in the rules 

or 

var testCon = Document.Batch.Project.EnvironmentVariables.Get("test_con"); in document processing scripts

  • Liked by
  • cristian ascencio
cristian ascencio posted this 22 December 2017

Yeap! i tried that code and worked just perfect

 

Thanks 4 ur help!!

Close