Discussion:
Accessing Column Extended Attribute in a GTL template
(too old to reply)
AK
2012-04-04 19:13:18 UTC
Permalink
Hello,

Before posting this question, I did the search the forums and didn't get a clear answer for this.

I am using PD v15.3 and I have created a Column Extended Attribute (AuditColumn) in the DBMS Resource File. This attribute is of type of boolean. I checked the Template checkbox while defining the extended attribute. I am able to view this attribute in the Table Columns view and I am able to check the columns which are considered audit columns.

I am developing a procedure template using GTL where I am creating a SQL statements for which I would like to skip all the columns which are set as AuditColumns. In the foreach_item loop what is the GTL syntax to access the AuditColumn value?

I tried the following and none of them worked:
1) .foreach_item(Table.Columns, "\n",",\n", %AuditColumn% = False)
%COLUMN%
.next(",\n")

2) Added generation path (Test)
.foreach_item(Table.Columns, "\n",",\n", %Test.AuditColumn% = False)
%COLUMN%
.next(",\n")
3) Used VB script
.foreach_item(Table.Columns, "\n",",\n", .vbscript ScriptResult = ActiveSelection.Item(0).GetExtendedAttribute("Test.AuditColumn").endvbscript = False)
%COLUMN%
.next(",\n")

Any help is appreciated.

Thanks.
AK
2012-04-06 00:26:21 UTC
Permalink
After doing a google search I found the solution for my question.

In order to make your template a bit more readable, I suggest you either
encapsulate this bit of code inside another GTL template or define a derived
extended attribute in your TableTemplateText XEM. This way, you'll be able
to use the attribute inside variable blocks (%ANNUAL_GROWTH_RATE%) and test
its value.

(1) As a GTL template

TableTemplateText::Profile\Table\Templates\ANNUAL_GROWTH_RATE

.vbscript
ScriptResult =
ActiveSelection.Item(0).GetExtendedAttribute("PDMGlobalExten.ANNUAL_GROWTH_RATE")
.endvbscript

(2) As a derived extended attribute

TableTemplateText::Profile\Table\Extended Attributes\ANNUAL_GROWTH_RATE

- Set data type to (String)
- Check the 'computed' checkbox.
- Under the Get Method Script tab, write

%Get% = obj.GetExtendedAttribute("PDMGlobalExten.ANNUAL_GROWTH_RATE")
Post by AK
Hello,
Before posting this question, I did the search the forums and didn't get a clear answer for this.
I am using PD v15.3 and I have created a Column Extended Attribute (AuditColumn) in the DBMS Resource File. This attribute is of type of boolean. I checked the Template checkbox while defining the extended attribute. I am able to view this attribute in the Table Columns view and I am able to check the columns which are considered audit columns.
I am developing a procedure template using GTL where I am creating a SQL statements for which I would like to skip all the columns which are set as AuditColumns. In the foreach_item loop what is the GTL syntax to access the AuditColumn value?
1) .foreach_item(Table.Columns, "\n",",\n", %AuditColumn% = False)
%COLUMN%
.next(",\n")
2) Added generation path (Test)
.foreach_item(Table.Columns, "\n",",\n", %Test.AuditColumn% = False)
%COLUMN%
.next(",\n")
3) Used VB script
.foreach_item(Table.Columns, "\n",",\n", .vbscript ScriptResult = ActiveSelection.Item(0).GetExtendedAttribute("Test.AuditColumn").endvbscript = False)
%COLUMN%
.next(",\n")
Any help is appreciated.
Thanks.
Hello,
Before posting this question, I did the search the forums and didn't get a clear answer for this.
I am using PD v15.3 and I have created a Column Extended Attribute (AuditColumn) in the DBMS Resource File. This attribute is of type of boolean. I checked the Template checkbox while defining the extended attribute. I am able to view this attribute in the Table Columns view and I am able to check the columns which are considered audit columns.
I am developing a procedure template using GTL where I am creating a SQL statements for which I would like to skip all the columns which are set as AuditColumns. In the foreach_item loop what is the GTL syntax to access the AuditColumn value?
1) .foreach_item(Table.Columns, "\n",",\n", %AuditColumn% = False)
%COLUMN%
.next(",\n")
2) Added generation path (Test)
.foreach_item(Table.Columns, "\n",",\n", %Test.AuditColumn% = False)
%COLUMN%
.next(",\n")
3) Used VB script
.foreach_item(Table.Columns, "\n",",\n", .vbscript ScriptResult = ActiveSelection.Item(0).GetExtendedAttribute("Test.AuditColumn").endvbscript = False)
%COLUMN%
.next(",\n")
Any help is appreciated.
Thanks.
Hello,
Before posting this question, I did the search the forums and didn't get a clear answer for this.
I am using PD v15.3 and I have created a Column Extended Attribute (AuditColumn) in the DBMS Resource File. This attribute is of type of boolean. I checked the Template checkbox while defining the extended attribute. I am able to view this attribute in the Table Columns view and I am able to check the columns which are considered audit columns.
I am developing a procedure template using GTL where I am creating a SQL statements for which I would like to skip all the columns which are set as AuditColumns. In the foreach_item loop what is the GTL syntax to access the AuditColumn value?
1) .foreach_item(Table.Columns, "\n",",\n", %AuditColumn% = False)
%COLUMN%
.next(",\n")
2) Added generation path (Test)
.foreach_item(Table.Columns, "\n",",\n", %Test.AuditColumn% = False)
%COLUMN%
.next(",\n")
3) Used VB script
.foreach_item(Table.Columns, "\n",",\n", .vbscript ScriptResult = ActiveSelection.Item(0).GetExtendedAttribute("Test.AuditColumn").endvbscript = False)
%COLUMN%
.next(",\n")
Any help is appreciated.
Thanks.
Loading...