Expand my Community achievements bar.

SOLVED

can I change xfa.sourceSet.DataConnection.connect.connectString.value

Avatar

Level 3

On LC Designer, I set up a data connection called DataConnection1 to access a certain file named a001.xls,

Here is the xml shows:

<sourceSet xmlns="http://www.xfa.org/schema/xfa-source-set/1.0/">
   <source name="DataConnection1" db="ado">
      <connect delayedOpen="1" timeout="15">
         <connectString>Provider=MSDASQL.1;Persist Security Info=False;Data Source=Excel Files;Mode=Read;Extended Properties="DSN=Excel Files;DBQ=C:\a001.xls;DefaultDir=C:;DriverId=790;MaxBufferSize=2048;PageTimeout=5;"</connectString>
         <user/>
         <password/>
      </connect>
      <command timeout="30">

-----------------------

I can display the value of xfa.sourceSet.DataConnection1.connect.connectString.value which shows above string.

Now I change the connectString via a button click such that I can use another file named a002.xls for the data connection by :

new_connStr = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=Excel Files;Mode=Read;Extended Properties=\"DSN=Excel Files;DBQ=C:\\a002.xls;DefaultDir=C:;DriverId=790;MaxBufferSize=2048;PageTimeout=5;\"";

xfa.sourceSet.DataConnection1.connect.connectString.value =  new_connStr;

Then when I display the value again, it still remains the same old connect string value.

Any ideas?

Rgds.

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

The sourceSet is locked down after the form is rendered. It is a security violation to change it after rendering. If you open the javascript console I am sure you will see a security violation error.

Paul

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

The sourceSet is locked down after the form is rendered. It is a security violation to change it after rendering. If you open the javascript console I am sure you will see a security violation error.

Paul

Avatar

Level 3

Dear Paul,

I see...

thanks for that.

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----