Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    launch a SQL query from the js file

    Hello,
    in my JS file I need to do a search on the DB (select * from table where condition) and store the result in an array(multidimensional)
    do you have an idea how to do it ?
    thank you in advance

    #2
    Create a DataSource and call fetchData() on it

    Comment


      #3
      I did that but it does not work !

      Code:
       
      // ----- DataSource --------
      isc.DataSource.create({
      	ID: "platform_coreaxis_security",
      			
      })
      
      
      //------------ The hierarchy TreeGrid : start ------------------------
      		this.FP_AxisTreeGrid = isc.TreeGrid.create({
      			ID: this.ID+"_TreeGrid"
      			,autoDraw:false
      			,FP_Parent:this.ID
      			,dataSource: platform_axis_view_hierarchy_members
      			,width: "100%"
      			,height: "100%"
      			,dataProperties:{
      				loadDataOnDemand:false
      				,FP_Parent:this.ID
      				,dataArrived:function (parentNode) {
      					AppCoreDynamicAxis_Action_Log(this.FP_Parent+"_TreeGrid.dataArrived:start");
      					this.openAll(); //To be able to get the index
      					this.closeAll();
      					
      					//Open the root
      					var myComponent = eval(this.FP_Parent);					
      					var myAxisCode = myComponent.FP_AxisObjectName;
      					var myTreeGrid = eval(myComponent.ID+"_TreeGrid"); 
      					var myHierarchyID = myComponent.FP_HierarchyID;
      					var myAxisID = myComponent.FP_AxisID;
      					var myAxisSelectedCode = myComponent.FP_AxisSelectedCode;
      					
      										 
      						
      					//Apply Securtiy Members
      					var myUserID 	= FPIUser.FP_fct_getID();
      					var myParentID 	= FPIUser.FP_fct_getParentID();
      					var myApplicationID = eval(this.FP_Parent).FP_ApplicationID;
      					var myAxisId = eval(this.FP_Parent).FP_AxisID;
      					
      					// --------------- here is the problem -----------------------------
      					var myRootMember = platform_coreaxis_security.fetchData({r_axse_idnum:2});
      										
      					AppCoreDynamicAxis_Action_Log(" \n\n\n\n*********** test *************** \nUserID : "+myUserID+"\n ");
      					AppCoreDynamicAxis_Action_Log("  ParentID : "+myParentID+"\n ");
      					AppCoreDynamicAxis_Action_Log("   AxisID : "+myAxisId+"\n ");
      					if(myRootMember != null) {AppCoreDynamicAxis_Action_Log("   RootID : "+myRootMember.r_axse_idnum+"\n ");}
      					else {AppCoreDynamicAxis_Action_Log("   RootID : NOT FOUND \n ");}
      					AppCoreDynamicAxis_Action_Log("   ApplicationID : "+myApplicationID+"\n ");
      					
      				
      					
      					//Apply Preselect
      					var myDataSelection = myTreeGrid.data.find({r_axvl_label:myAxisSelectedCode});
      					if (myDataSelection == null) myDataSelection = myTreeGrid.data.get(0);
      					
      					//Store in the object the selected elements
      					myComponent.FP_LabelID = myDataSelection.r_axvl_idnum;
      					myComponent.FP_LabelName = myDataSelection.r_axvl_label;
      					myComponent.FP_LabelDesc = myDataSelection.r_axvl_desc;
      					eval(myComponent.FP_RecordClick+"'"+myComponent.FP_AxisObjectName+"',myDataSelection.r_axvl_idnum,myDataSelection.r_axvl_label,myDataSelection.r_axvl_desc);");
      					myTreeGrid.selectSingleRecord(myDataSelection);
      					
      					AppCoreDynamicAxis_Action_Log(this.FP_Parent+"_TreeGrid.dataArrived:end");
      					}
      				}
      			,sortField : "r_axvl_label"
      			,fields: [ 
      					{name:"r_axvl_label", title:"[ "+this.FP_AxisObjectName+" ]" ,frozen:true,width:"150" }
      					,{name:"r_axvl_desc", title:"Description"  ,showHover:true }
      					,{name:"r_axvl_attr01", title:getUIMsg("book_attribute",4)+" (1)"  ,showHover:true , showIf:(""+this.FP_ShowAttribute01)}
      					,{name:"r_axvl_isactive", title:"Is Active" , showIf:(""+this.FP_ShowInactiveLabels)}
      					,{name:"alerter", title:"Dash." ,showHover:false, showIf:"false",width:40, type:"image", align:"center", imageURLPrefix:getUIIconPath()+"icon_alerter_", imageURLSuffix:"_16.png"}
      					,{name:"approuved_count", title:"Appr."  ,showHover:false, showIf:"false",align:"center",width:40 }
      					,{name:"waiting_count", title:"Wait."  ,showHover:false, showIf:"false",align:"center",width:40 }
      					]
      
      			});

      Comment


        #4
        thank you ! I resolved the problem :)

        Comment

        Working...
        X