2 Replies Latest reply on Aug 20, 2010 3:46 AM by welcomecan

    data reterive problem?

    welcomecan Level 1

      hai friends,

       

        i reterive  data from db.i sent two queries using struct. In flex i am creating dynamic form.

       

      var

       

       

       

       

       

      resdata2:ArrayCollection=event.result.RES2;

       

      var resdata1:ArrayCollection=event.result.RES1;

       

       

       

       

      for(i=0;i<resdata1.length;i++)

      {

       

       

      var

       

       

      lblform:Label=new Label();

       

      lblform.text=resdata1[i].spk_name;

      lblform.width=100;

      lbl.addElement(lblform);

       

      if(resdata1[i].hasOptionsList==null)

      {

       

      var newtxtbox:TextInput=new TextInput();

      newtxtbox.width=300;

       

      var txtres:String;

      txtres=resdata1[i].keyvariablename;// db field name

       

      var tmpdata:String=resdata2[0]+"."+txtres;// here issue

      newtxtbox.text=tmpdata;

      lbl.addElement(newtxtbox);

      }

       

      }

       

      help me

        • 1. Re: data reterive problem?
          Balakrishnan V Level 3

          Could you elaborate ? What is the issue ? Or else, just post your code here fully, if it is small enough !

          • 2. Re: data reterive problem?
            welcomecan Level 1

            in resdata2 inclde data

              dname->document name,

            dnum->document number

             

             

            <?xml version="1.0" encoding="utf-8"?>

            <s:Application

             

             

            xmlns:fx="http://ns.adobe.com/mxml/2009"

            xmlns:s="

            library://ns.adobe.com/flex/spark"

            xmlns:mx="

            library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">

             

             

            <fx:Script>

            <![CDATA[

             

             

            import mx.collections.ArrayCollection;

             

            import mx.containers.FormItem;

             

            import mx.controls.Alert;

             

            import mx.controls.Text;

             

             

            import spark.components.ComboBox;

             

             

            public function txtchange():void

            {

             

             

            var a:String=txtarea.text;

             

            }

             

            public function search_click()

            {

             

             

            //var date:Date = new Date();

             

             

            //Alert.show("Date: "+date.toLocaleString());

             

             

            //Logon.fnatt("view","4563","0");

             

             

            //Logon.viewf("1","4436","","file_view","Open");

             

             

            //Logon.fneditatt("Edit","4080");

             

             

            //Logon.editattr("do_edit","B59BAA32CD9C28E5825FC281109E6228","4563","New Text Document_20100323003136805.txt", " ","{ts '2010-07-27 00:41:20'}","New Text Document","New Text Document","txt","Testing file","TEsting file","this is test file.. asa dhan");

             

             

            //Logon.editattrfirst("Edit","4387");

            Logon.fneditatt(

             

            "Edit","3986");

            }

             

            private function handlelogonResult(event):void

            {

             

             

            if(event.result)

            {

             

            var resdata:ArrayCollection=event.result.RES2;

             

            var profileid:int;

             

            var i:int;

             

            if(resdata[0].storage_profile_id==null)

            {

             

             

            /* for(i=0;i<resdata.length;i++)

            {

            Alert.show("welcome","alert");

            } */

             

            Alert.show(

             

            "single","alert");

            }

             

            else

             

            {

             

             

            var resdata2:ArrayCollection=event.result.RES2;

             

            var resdata1:ArrayCollection=event.result.RES1;

             

            for(i=0;i<resdata1.length;i++)

            {

             

            /* var tmpLbl:Label = new Label();

            tmpLbl.x = 10;

            tmpLbl.y = 5;

            tmpLbl.text = "Label Text"; */

             

             

             

            /* var k:int = 30;

            var j: int = 40;

            var counter:int = 0; */

             

             

             

            for(i=0;i<resdata1.length;i++)

            {

             

            /* var newlabel:Label=new Label();

            newlabel.text=resdata1[i].spk_name;

            //pn.addChild(newlabel);

            pn.addElement(newlabel);

            k =125;

            j+=20;

            if (counter >=resdata1.length)

            { counter = 0; k=10; j+=30;}

            newlabel.x= k ;

            newlabel.y = j;

            counter++; */

            pn.visible=

             

            false;

             

            //var lbl : Label = new Label();

             

             

            var lbl:FormItem=new FormItem();

             

            /* lbl.width = 130;

            lbl.height = 27;

             

            lbl.label = resdata1[i].spk_name; */

            lbl.direction=

             

            "horizontal";

             

             

            //lblContainer.addChild(lbl);

             

             

             

            var lblform:Label=new Label();

             

            lblform.text=resdata1[i].spk_name;

            lblform.width=100;

            lbl.addElement(lblform);

             

            if(resdata1[i].hasOptionsList==null)

            {

             

            var newtxtbox:TextInput=new TextInput();

            newtxtbox.width=300;

            newtxtbox.id=

            "txt_"+ resdata1[i].keyvariablename;

             

            newtxtbox.text=resdata2  // first txtbox i need document name.second txtbo i need documentnumber

                                                             //i am used to take length of resdata.but it shows 1

            lbl.addElement(newtxtbox);

            }

             

             

            if(resdata1[i].hasOptionsList!==null)

            {

             

            var newcb:ComboBox=new ComboBox();

            newcb.width=300;

             

            /* newcb.height=27; */

             

             

            //var bindata:ArrayCollection=resdata1[i].ruleName;

             

             

             

             

            /* var n:int; */

             

             

             

            /* for(n=0;n<resdata1[i].ruleName.length;n++)

            {

            tem[n]=resdata1[i].ruleName[n].spko_value.concat();

             

            } */

             

             

             

            /* tem=resdata1[i].ruleName.spko_value.concat(); */

             

             

             

            var tempdata:ArrayCollection=resdata1[i].ruleName;

             

            //newcb.dataProvider=bindata;

            newcb.dataProvider=tempdata;

            newcb.labelField=

             

            "spko_value";

            lbl.addElement(newcb);

            }

             

            lblContainer.addElement(lbl);

            }

            pn1.visible=

            true;

             

            lblContainer.visible=

            true;

             

            /* var m:int=40;

            for(i=0;i<resdata1.length;i++)

            {

            if(resdata1[i].hasOptionsList==null)

            {

            var newtxtbox:TextInput=new TextInput();

            newtxtbox.text="1";

            pn.addElement(newtxtbox);

            k=250;

            m+=30;

            if (counter >=resdata1.length)

            { counter = 0; k=10; m+=30;}

            newtxtbox.x= k ;

            newtxtbox.y = m;

            counter++;

             

            }

             

            }

            */

             

            pn1.title=resdata1[0].ProfileName;

            }

             

             

            //Alert.show("Double","alert");

             

             

            //pn.visible=true;

             

            }

             

            }

             

            }

             

             

            private function handlelogonFault(event):void

            {

             

            Alert.show(event.fault.message);

             

            //Alert.show("Incorrect","Alert");

            }

             

            ]]>

             

             

            </fx:Script>

             

             

            <s:Button id="btn_search" x="220" y="20" label="Search" click="search_click();"/>

             

             

            <s:TextArea id="txtarea" change="txtchange()" />

             

             

            <!--<s:VGroup id="lblContainer" width="180" height="150" verticalAlign="middle" verticalScrollPosition="2" />-->

             

             

             

            <s:Panel title="Form Container Example" id="pn1"

             

            horizontalCenter="

            0" verticalCenter="0" visible="false">

             

             

             

            <!--<s:VGroup left="10" right="10" top="10" bottom="10">-->

             

             

            <mx:HBox>

             

             

             

             

            <mx:Form

            id="

             

            lblContainer" verticalGap="2" indicatorGap="14" paddingBottom="10"

            paddingTop="

            16"

             

            />

             

             

            </mx:HBox>

             

             

            <!--</s:VGroup>-->

             

             

            </s:Panel>

             

             

            <!--<mx:VBox id="lblContainer" width="180" height="150" verticalGap="2" visible="false"/>-->

             

             

             

            <s:Panel id="pn" width="100%" visible="false">

             

            <s:Label id="newlabel" x="200" y="300"/>

             

            <s:TextInput id="newtxtbox" />

             

            </s:Panel>

             

             

             

            <fx:Declarations>

             

            <s:RemoteObject destination="ColdFusion" id="Logon" source="IST_Business_Applications.IST_Docstor.file_access.editattrfirst" >

             

            <s:method name="fneditatt" fault="handlelogonFault(event)" result="handlelogonResult(event)" />

             

            </s:RemoteObject>

             

            <!-- Place non-visual elements (e.g., services, value objects) here -->

             

            </fx:Declarations>

            </s:Application>