Field expression within a field expression

Field expression within a field expression

Anonymous
Not applicable
1,025 Views
3 Replies
Message 1 of 4

Field expression within a field expression

Anonymous
Not applicable

Hi,

 

If I add a field expression from the category AEC Database, and link to a excel sheet, I can copy this field expression:

 

%<\AecDb "DatabaseField" "*NONE*" "Provider=MSDASQL.1;Persist Security Info=False;
Extended Properties=<&quot;>DBQ=C:\Users\REMILA\Desktop\TESTING_LINKING\PROJECT_DRAWING_LIST.xls;
DefaultDir=C:\Users\REMILA\Desktop\TESTING_LINKING;Driver={Microsoft Excel Driver (*.xls)};
DriverId=790;FIL=excel 8.0;FILEDSN=C:\Users\REMILA\Documents\DataSource01.dsn;MaxBufferSize=2048;
MaxScanRows=8;PageTimeout=5;ReadOnly=1;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;
<&quot;>" "Sheet1$" "ID" "2" "SELECT [ID] FROM [Sheet1$]" "4" \f "%ut0%pu3%sc1%rv0%zl%zt">%

The "4" at the end of the formula is the actual row in the excel sheet to return the cell value from.

 

Now comes my question:

What can I do to replace this "4" with another field expression. At the moment I'm interested in replacing it with: 

 

%<\AcVar ctab>%

 

This would return the name of the current layout tab. The idea would then be that the name of the layout would decide which row to get data from.

 

If replace "4" by %<\AcVar ctab>% in the code mentioned at the top, and put this in a text (mtext) in autocad, I get my correct value. 

BUT as I understand it, the %<\AcVar ctab>% is now longer linked, and a new field expression (AEC Database) is basically created with a non-variable value for the row number.

 

What can I do to have my expression constantly linked to another variable?

 

I hope my question is understandble. Thanks in advance

0 Likes
1,026 Views
3 Replies
Replies (3)
Message 2 of 4

dbroad
Mentor
Mentor

No guarantees but using a formula field for the top level might accomplish it.   Have you already tried this?  In the field editor, highlight the 4, right click and choose insert field.  Then try a variable field (or something similiar).

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 3 of 4

Anonymous
Not applicable

Thank you, but yes I tried it. And I think it would have worked if was a number I would want to display. But in my case it is a string. The formula field is "forced" through a formating of the number, and it fails to display a text.

 

0 Likes
Message 4 of 4

dbroad
Mentor
Mentor

If you want more input from other users, I suggest that you attach a drawing and an excel file with the data set up as you are currently using it.  It is unlikely that any of us would have the time or willingness to recreate your base situation in order to test alternatives with you.

Architect, Registered NC, VA, SC, & GA.
0 Likes