Hi All,
I am using DFC 6.5v, by using dfc i am binding database values to the dropdown list. The values are displaying but now i wat select a default value wen the compponent is initlized.Please any body assist me how can i do that.
I'll try to do my best guessing the details of your question.
I suppose you are asking about populating the com.documentum.web.form.control.DropDownList inside your cusom WDK component? If yes, then did you try DropDownList.setValue(someValue)?
Where someValue is the value that has already been populated into the dropdownlist.
Thanks for ur help, but i already did like this its not working..........
Posting your code would be helpful.
Here the code, i am using this method to bind the values to the dropdown
public void getCategory(String objtype){
IDfSession ses=getDfSession();
documentCategoryDropdown=(DropDownList)getControl("document_category",com.documentum.web.form.control.DropDownList.class);
documentCategoryDropdown.setMutable(true);
documentCategoryDropdown.clearOptions();
IDfCollection col=null;
String strDocCategory=null;
IDfQuery qry=new DfQuery();
ArrayList<String> correspondDocCategory=new ArrayList<String>();
String qryString=null;
if(objtype.equals("esd_")){
qryString="select l1.level_1 from dm_dbo.mbd_attr_types t, dm_dbo.mbd_attr_level_1 l1 where l1.attr_type_id = t.attr_type_id and t.document_type = 'esd_document_webtop' and t.attribute_type = 'document_category' order by l1.level_1";
}else{
qryString="select l1.level_1 from dm_dbo.mbd_attr_types t, dm_dbo.mbd_attr_level_1 l1 where l1.attr_type_id = t.attr_type_id and t.document_type = '"+objtype+"' and t.attribute_type = 'document_category' order by l1.level_1";
}
qry.setDQL(qryString);
try{
col=qry.execute(ses, IDfQuery.READ_QUERY);
while(col.next()){
strDocCategory=col.getString("level_1");
correspondDocCategory.add(strDocCategory);
//addVA(engineVA, engineName, engineName);
for(int i=0;i<correspondDocCategory.size();i++){
strDoccumentategory=correspondDocCategory.get(i);
Option opt=new Option();
opt.setLabel(strDoccumentategory);
opt.setValue(strDoccumentategory);
documentCategoryDropdown.addOption(opt);
documentCategoryDropdown.setValue("someString");
}catch (Exception e) {
e.printStackTrace();
}finally{
try {
col.close();
} catch (DfException e) {
i am calling this method in onRender() method, because i have another dorpdown to diaspay valuese based on this value.
I used
dropdownlist.setValue() method internally the value set but for in interface its not selecting that value as a default....
Where is public void getCategory() getting defined? Is this in your attributes component class? If so, are you calling this method on component init and/or refresh?
it is in my component class it self, i am calling this method in onrender method.
Well, this is odd.
I'd start by making sure that whatever the value is being passed in the setValue("someString") is identical to one of the values in
you know - trailing spaces maybe, case etc.
Can you also show your jsp code where you define your dropdown?
What happens if you do this in onInit?
if i use this method in onInit(), the first time component is initlize it will call right, but wen the user change his selection for category then it component will call onrender() method.....so thats y i am calling this in onrender(). is it righrt?
if i use JSP code .....the values will be duplicated.....because i am already displaying values theow coding..
I'm confused. Your original post said "...i wat select a default value wen the compponent is initlized." Hence, my response to you to put your logic on onInit.
Is your component class bound to an actual object? If so, then you dont have to do any customization if you want an attribute to be rendered as picklist. Just define value assistance query using Composer or DAB.
i have two attributs category and subcategory, based on the selected objectype i need to get the values frm database and dispaly the values in dropdwon for import componet. the two dropdowns are dipendent dropdowns. for me its working fine i am displaying values but i need to select one default value when the component is initlize and it is also depend on the selected object type frm objecttype list in import. i am getting problem wen i set the default value to the category dropdown. in this case value assisstance will not wrk i think so.
You can perform a union across a registered table (which stores your default type for your object type) and frm database. Thus, value assistance can still work in this case.
can u plase explan or else can u please send me a sample query for value assistance..........
shree.thota wrote:i have two attributs category and subcategory, based on the selected objectype i need to get the values frm database and dispaly the values in dropdwon for import componet. the two dropdowns are dipendent dropdowns. for me its working fine i am displaying values but i need to select one default value when the component is initlize and it is also depend on the selected object type frm objecttype list in import. i am getting problem wen i set the default value to the category dropdown. in this case value assisstance will not wrk i think so.
sounds simple but is a complex and painful piece of coding. Forget about it in this "work phase". Give your customer depended value assistance.
When you have a free month or three, go back to this problem
Value assistance query is like any other query. The main difference is that you can pass the value of previous attribute value as criteria for filtering:
category VA: select cat from dm_dbo.categories where object_type='$value(r_object_type)'
subcategory VA: select subcat from dm_dbo.subcategories where cat='$value(cat)'
I suggest more about value assistance:
http://developer-content.emc.com/developer/downloads/ValueAssistance.pdf
this one i need to implement in import component, so in import we dont have any attribute like r_object_type, so how we ll pass this value into the query.
In value asssitance you can chose the dropdown based on other attribute like you can put in where clause:
select name from abcd where text='$value'
based onthe type dropdown in import component i need to dispaly the values, but in value assistance query how we ll pass the dropdown value. bcoz its not a attribute.
Value is the attribute name which will be selecting..
i know the query
this i need to implement in import component. When the user importing any document he needs to select the object type from the drom down, so how can i pass the object type value to the value asisstance query. because its not stored any where.
Have you tried using $value(r_object_type)?
If that doesnt work, you may have to make the attribute visible and have it come before the rest of your attributes. I noticed that if you attribute is not displayed (or is hidden), value$ doesnt seem to work.