function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sandeep reddy 37sandeep reddy 37 

about schemaprogramng not executing


i need to fetch the objects  by using selected list it will shows related child objects 
how we do 
public class schemaprograming {
    public list<selectoption> cobj {set;get;}
    public  string name1{set;get;}
    public list<string> field{set;get;}
    public list<selectoption> opt{set;get;}
    public sobject myobject{set;get;}
    public schemaprograming(){
        field=new list<string>();
        
        opt=new list<selectoption>();
        map<string,schema.SObjectType> myobj=schema.getGlobalDescribe();
        set<string> keys=myobj.keySet();
        list<string> order =new list<string>();
        order.addAll(keys);
        order.sort();
        for(string a:order){
            selectoption s =new selectoption(a,a);
            opt.add(s);
               
                    
            Schema.DescribeSObjectResult child= myobject.sobjecttype.getdescribe();
            list<schema.ChildRelationship> R = child.getchildrelationships();
            for(schema.ChildRelationship p :R){
                
                cobj=new list<selectoption>();
                string name1 =''+p.getChildsobject();
                selectoption c1 =new selectoption(name1,name1);
                cobj.add(c1);
            }
                }
            } 
        }



------------------vf page -----------------------------------------------
<apex:page controller="schemaprograming" readOnly="true">
    <apex:form >
       <apex:pageMessage severity="champakmala"  />
        <apex:pageBlock title="standard and custem objects">
            <apex:pageBlockSection >
                <apex:selectList value="{!myobject}" size="1" >
                    <apex:actionSupport event="onchang" reRender="cod" />
            <apex:outputLabel value="objects"/>&nbsp;
            <apex:selectOptions value="{!opt}"/>
            </apex:selectList>
                </apex:pageBlockSection>
                      </apex:pageBlock>
                    <apex:pageBlock title="child objects" id="cod">
                    <apex:selectList size="6" value="{!field}">
                        <apex:selectOptions value="{!cobj}"/>
                    </apex:selectList>
                    </apex:pageBlock>

    
    </apex:form>
</apex:page>