Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Data Souce from Table in Attribute

Status
Not open for further replies.

ujjval090683

Programmer
Nov 1, 2011
31
IN
How can I add a data source to any attribute in Category.
I saw one category attribute details as below. How can I create like that?

Attribute Name: Vendor

A<1,?,Required=false,DisplayName=Vendor,customSQL=false,ValidKeyAttr={},ValidValues={select distinct Vendor from File_Data order by Vendor},Type=10013,NumRows=1,ID=6,ValidField=Vendor,RegionName=Attr_4609878_6,MaxRows=1,ValidKeyField={},ValidTable=File_Data,ValidKeyValue={},Search=true,FixedRows=true>

How can I retrive the data source values? Using the Below query?
select distinct Vendor from File_Data order by Vendor


 
h'mm that means that the values are in the livelink schema but i think even if you were able to do that you will still be in trouble.
adding a table key look up happens when you install the attribute extensions or in a different way the ADN(automatic document numbering) module.OT recently released support for attribute extensions meaning you will get the same look and feel in a lapi program as you do in the gui where one value filters the other.

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
data source values will depend on the SQL used in the TKL, this can also include some additioanl variables such as the value of other field which can make the SQL very complex.

Attributes Ext also has a very strong parser which processes the generated SQL for security, removing UPDATE, CREATE, DELETE statements etc so you need to bear that in mind, and there have been a few issues with that parser recently.

Greg Griffiths
Livelink Certified Developer & ECM Global Star Champion 2005 & 2006
 
If you have access to Builder, and want to try making your own module, one option would be create your own Attribute type based on the existing "Text: Popup". I'd just done an article on Custom Attributes HERE. Your ValidValues list could then get populated from a CAPI.Exec call. Would take about 30 mins to write something basic I would think.

If you wanted to be more clever you could even store a Foreign Key for the selected value, rather than the String value itself.

Some things to bear in mind - which will take a LOT longer to do:
- every category page render will involve a bunch of queries - possible performance hit - consider preloading datasets, caching, etc
- SQL injection! Check or restrict any queries people can create. Have a special database user account for this functionality.
- What do you do about selected values that are no longer in the external table?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top