cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Creating custom preference with loadfile

rhart
16-Pearl

Creating custom preference with loadfile

Version: Windchill 12.1

 

Use Case: Need to create a preference which only accepts a number as input


Description:

I can create string, type or boolean preferences using a loadfile with the right handler, but I cant find any example handler for Integer, does it exist?

 

e.g. Boolean

com.ptc.windchill.enterprise.preference.handler.BooleanPreferenceValueHandler:

e.g. String

com.ptc.windchill.enterprise.preference.handler.StringPreferenceValueHandler:400:400

e.g. Type Picker

com.ptc.windchill.enterprise.search.preference.handler.TypePreferenceValueHandler:/com/ptc/windchill/enterprise/search/allSearchTypes

e.g. Integer

??? where do you find it?

 

e.g. Preference loadfile

 

 

<?xml version="1.0"?>
<!DOCTYPE NmLoader SYSTEM "standardX10.dtd">
<NmLoader>

	<!-- Clean up first-->
	<csvUnlinkPreferenceClientDefinition
		handler="wt.preference.LoadPreference.deleteClientDefinitionLink">
		<csvname>/ext/ws/elecReportDocumentType</csvname>
		<csvclientName>WINDCHILL</csvclientName>
	</csvUnlinkPreferenceClientDefinition>
	<csvDeletePreferenceDefinition
		handler="wt.preference.LoadPreference.deletePreferenceDefinition">
		<csvname>/ext/ws/elecReportDocumentType</csvname>
	</csvDeletePreferenceDefinition>
		
    <csvPreferenceDefinition handler = "wt.preference.LoadPreference.createPreferenceDefinition">    
		<csvname>/ext/ws/elecReportDocumentType</csvname>    
		<csvvisibility>ORGANIZATION</csvvisibility>    
		<csvcategoryName>COMPANYE_WS</csvcategoryName>    
		<csvdisplayName>ext.core.prefs.PreferenceRB:COMPAN_WS_ELEC_REPORT_DOC_TYPE</csvdisplayName>    
		<csvdescription>ext.core.prefs.PreferenceRB:COMPANY_WS_ELEC_REPORT_DOC_TYPE_SHORT_DESC</csvdescription>    
		<csvlongDescription>ext.core.prefs.PreferenceRB:COMPANY_WS_ELEC_REPORT_DOC_TYPE_LONG_DESC</csvlongDescription>    
		<csvdefaultValue>WCTYPE|wt.doc.WTDocument</csvdefaultValue>    
		<csvhandler>com.ptc.windchill.enterprise.search.preference.handler.TypePreferenceValueHandler:/com/ptc/windchill/enterprise/search/allSearchTypes</csvhandler>
	</csvPreferenceDefinition>
	<csvLinkPreferenceClientDefinition handler = "wt.preference.LoadPreference.setClientDefinitionLink">   
		<csvname>/ext/ws/elecReportDocumentType</csvname>
		<csvclientName>WINDCHILL</csvclientName>
	</csvLinkPreferenceClientDefinition>
    
</NmLoader>

 

ACCEPTED SOLUTION

Accepted Solutions
HelesicPetr
22-Sapphire I
(To:rhart)

Hi @rhart 

If you try to search a csvPref definition in all files in the Windchill folder, you could find what you are looking for. 

example with number

 

  <csvPreferenceDefinition handler="wt.preference.LoadPreference.createPreferenceDefinition">
       <csvname>/Tables/DataSourceClientSideLimit</csvname>
       <csvvisibility>USER</csvvisibility>
       <csvcategoryName>TABLES_CATEGORY</csvcategoryName>
       <csvdisplayName>com.ptc.core.components.rendering.renderResource:CLIENT_SIDE_DATASOURCE_MAX_LIMIT_NAME</csvdisplayName>
       <csvdescription>com.ptc.core.components.rendering.renderResource:CLIENT_SIDE_DATASOURCE_MAX_LIMIT_DESC</csvdescription>
       <csvlongDescription>com.ptc.core.components.rendering.renderResource:CLIENT_SIDE_DATASOURCE_MAX_LIMIT_LONG_DESC</csvlongDescription>
       <csvdefaultValue>2000</csvdefaultValue>
       <csvhandler>com.ptc.windchill.enterprise.preference.handler.NumberPreferenceValueHandler:1:100000</csvhandler>
   </csvPreferenceDefinition>

HelesicPetr_0-1727680395538.png

 

 

PetrH

View solution in original post

3 REPLIES 3
HelesicPetr
22-Sapphire I
(To:rhart)

Hi @rhart 

If you try to search a csvPref definition in all files in the Windchill folder, you could find what you are looking for. 

example with number

 

  <csvPreferenceDefinition handler="wt.preference.LoadPreference.createPreferenceDefinition">
       <csvname>/Tables/DataSourceClientSideLimit</csvname>
       <csvvisibility>USER</csvvisibility>
       <csvcategoryName>TABLES_CATEGORY</csvcategoryName>
       <csvdisplayName>com.ptc.core.components.rendering.renderResource:CLIENT_SIDE_DATASOURCE_MAX_LIMIT_NAME</csvdisplayName>
       <csvdescription>com.ptc.core.components.rendering.renderResource:CLIENT_SIDE_DATASOURCE_MAX_LIMIT_DESC</csvdescription>
       <csvlongDescription>com.ptc.core.components.rendering.renderResource:CLIENT_SIDE_DATASOURCE_MAX_LIMIT_LONG_DESC</csvlongDescription>
       <csvdefaultValue>2000</csvdefaultValue>
       <csvhandler>com.ptc.windchill.enterprise.preference.handler.NumberPreferenceValueHandler:1:100000</csvhandler>
   </csvPreferenceDefinition>

HelesicPetr_0-1727680395538.png

 

 

PetrH

Thanks @HelesicPetr  I found it in there, it's called com.ptc.windchill.enterprise.preference.handler.NumberPreferenceValueHandler:1

I was searching Integer

HelesicPetr
22-Sapphire I
(To:rhart)

Hi @rhart 

I used "csvPreferenceDefinition" as a search key word ::D

PetrH

Announcements

Top Tags