Tree dataProvider from PHP

Hello all!
I see in the web many many many example how to populate a
Tree, but, i cant find no example how to populate a Tree FROM PHP.
I am using HTTPService and know how to use it but, i don't
know the structure of nodes.
In PHP file, i am doing this:
echo "<node label='root'><node label='NODE
1'><node label='child 1 of NODE 1' /><node label='child
2 of NODE 1' /></node></node>";
and, in the Tree, I am putting:
dataProvider="{myHttpService.lastResult}"
but, nothing happens, no result in Tree!
What is the correct way?

I've got my list populating correctly from XML generated by
php but any time I click on a folder in the tree list I get an
error:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" creationComplete="dirListSvc.send();">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
[Bindable]
private var dirList:XML;
[Bindable]
public var selectedNode:XML;
// Event handler for the Tree control change event.
public function treeChanged(event:Event):void {
selectedNode=Tree(event.target).selectedItem as XML;
private function
directoryResultHandler(event:ResultEvent):void
dirList = event.result as XML;
// Fault handler - displays the error
private function
directoryFaultHandler(event:FaultEvent):void
Alert.show(event.fault.message, "Could not load dirList");
]]>
</mx:Script>
<mx:HTTPService
id="dirListSvc"
url="
http://localhost/iqAssets/scripts/directory.php"
resultFormat="e4x"
result="directoryResultHandler(event);"
fault="directoryFaultHandler(event);"
/>
<mx:HDividedBox width="100%" height="100%">
<mx:Tree x="10" y="10" labelField="@label"
dataProvider="{dirList}" width="250" height="530"
change="treeChanged(event)"/>
<mx:Panel height="100%" width="50%"
title="{selectedNode.@label}">
<mx:Text text="{selectedNode.@path}" />
<mx:Image source="{selectedNode.@path}" />
</mx:Panel>
</mx:HDividedBox>
</mx:Application>

Similar Messages

  • Populate Flex tree control from mysql

    Hi
    I am just learning Flex and I started playing with the Tree
    control. I am trying to populate the Tree from Mysql using php and
    I am just hitting wall after wall.
    Please Help
    Thanks in advance

    quote:
    Originally posted by:
    ntsiii
    Stop running and get a map (read the documents)
    This is hardly a useful comment and must discourage new users
    from asking questions. If you think the documentation relating to
    the use of the tree control is straightforward then I beg to
    differ.
    If you are aware of a clear example of how to use the data
    tree with a php backend returning a remote data object please
    enlighten me. Meanwhile I continue my search but not within the
    livedocs.
    One site I have found that may be of use is
    http://flexdiary.blogspot.com/2009/01/lazy-loading-tree-example-file-posted.html
    Not everyone is an expert.

  • How to populate DataGird with data returned from php page?

    Hi, I'm new in Flex, I try to populate DataGrid with data from PHP, My code is
    <mx:HTTPService 
    id="personRequest" result="getPerson(event)" url=http://localhost/searchPerson.php useProxy="false" method="POST" showBusyCursor="true" resultFormat="e4x">
    </ mx:HTTPService>
    <mx:DataGrid 
    id="searchResult" dataProvider="{???what to paste here???}" y="30">
    </mx:DataGrid>
    private  
    function getPerson(evt:ResultEvent):void { var res:XMLList = evt.result..dane as XMLList;searchResults =
    new XMLListCollection(res); 
    output from PHP
    <person>
    <dane>
    <name>ABC</name>
    <street>XLXXLX</street>
    </dane>
    <dane>
    <name>DEF</name>
    <street>YAYAYAY</street>
    </dane>
    </person>
    If I set the dataProvider as "searchResults" it doesn't work. I probably have to set as dataprovider any ArrayCollection , but I don't know how to convert my XMLListCollection to it.
    Could anyone help me populate Datagrid with
    name | streer
    ABC, XLXXLX
    DEF, YAYAYAY
    Best Regards,
    Mariusz

    Thanks for your reply, but I'm afraid it doesn't work :-( Could you browse my code and check what I'm doing wrong???
    full mxml code:
    <?xml version="1.0" encoding="utf-8"?><mx:Application 
    xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="personRequest.send()">
    <mx:Script><![CDATA[
         import mx.rpc.events.ResultEvent; 
         [Bindable]
         public var searchResultsXML:XML;  
         private  function getPerson(evt:ResultEvent):void 
          {          searchResultsXML = (evt.result
    as XML);
              trace(searchResultsXML);     }
    ]]></mx:Script>  
    <mx:HTTPService 
    id="personRequest" result="getPerson(event)" url=http://localhost/searchPerson.php useProxy="false"
    method="POST" showBusyCursor="true" resultFormat="e4x"></mx:HTTPService>
    <mx:DataGrid  id="searchResult" dataProvider="{searchResultsXML.dane}"></mx:DataGrid>
     </mx:Application> 
    trace statement returns:
    <person>
    <dane>
    <id>1</id>
    <nazwisko>Topczewski</nazwisko>
    <imie>Mariusz</imie>
    <imie2/>
    <miejscowosc>Bia?ystok</miejscowosc>
    <ulica>Nowogródzka</ulica>
    <dom>7B</dom>
    <lokal>25</lokal>
    </dane>
    <dane>
    <id>1</id>
    <nazwisko>Topczewski</nazwisko>
    <imie>Mariusz</imie>
    <imie2/>
    <miejscowosc>Bia?ystok</miejscowosc>
    <ulica>Sybiraków</ulica>
    <dom>15</dom>
    <lokal>27</lokal>
    </dane>
    </person>

  • How to populate Tree structure from BAPI while tree grows or shrinks

    Hi All
    Currently I am populating the tree structure from BAPI based on the HLevel (Hierarchy  Level) parameter, but when ever insertion and deletion happens in the tree at any level in the UI and at the same time i am updating these tree node values with HLevel value(example : 1 is first level , 2 is second level, 3 is third level etc)  updating successfully& correctly  into the BAPI, no issues.
    Once it is updated into the BAPI, next time when i refreshed the UI then i am not populating the tree structure correctly from BAPI with updated new nodes based on the HLevel. when tree struture grows or shrinks in the BAPI after updating into BAPI from UI then i am not populating the tree sturcture correctly based on the HLevel value from the BAPI.
    Please let me know any sample code how to populate tree structure correctly when tree structure grows or shrinks based on the HLevel value ( Hierarchy Level , for example : 1 is level , 2 is 2nd level , 3 is third level nodes etc)
    anybody helps in this regard with sample code on the populating tree tructure then it would be great help to me.
    Thanks in advance
    Regards
    Kalki Reddy
    Edited by: KalkiReddy on Nov 29, 2009 3:48 PM

    Bapi output node:
    Value     | Text     | HLevel
    01     | A     | 1               
    0101     | AA       | 2
    010101     | AAA     | 3
    01010B     | AAB     | 3
    0102     | AB     | 2
    02     | B     | 1
    0201     | BA        | 2
    This code is used to build the tree in wdDoInit method
         IE_T_CatalogueNode catalogueNode = wdContext.nodeE_T_Catalogue();
         int size = catalogueNode.size();
         ICatalogoElement level1elem = null;
         for (int i = 0; i < size; i ++)
              IE_T_CatalogueElement catalogueElem = catalogueNode.getE_T_CatalogueElementAt(i);
              if (catalogueElem.getLevel().equals("1"))
                   // 1 Livello
                   level1elem = wdContext.createCatalogoElement();
                   level1elem.setKATALOGART_CODE(catalogueElem.getKatalogart());
                   level1elem.setCODEGRUPPE_CODE(catalogueElem.getCodegruppe());
                   level1elem.setCODE(catalogueElem.getCode());
                   level1elem.setCODE_DESCR(catalogueElem.getKatalogart_Descr());
                   level1elem.setDESCR(catalogueElem.getKatalogart_Descr());
                   wdContext.nodeCatalogo().addElement(level1elem);
                   for (int j = i + 1; j < size; j ++)
                        IE_T_CatalogueElement catalogueElem2level =
                                                 catalogueNode.getE_T_CatalogueElementAt( j );
                        String level2 = catalogueElem2level.getLevel();
                        if (level2.equals("2"))
                             ICatalogoElement level2elem = level1elem.nodeChild().createCatalogoElement();
                             level2elem.setKATALOGART_CODE(catalogueElem2level.getKatalogart());
                             level2elem.setCODEGRUPPE_CODE(catalogueElem2level.getCodegruppe());
                             level2elem.setCODE(catalogueElem2level.getCode());
                             level2elem.setCODE_DESCR(catalogueElem2level.getCodegruppe_Descr());
                             level2elem.setDESCR(catalogueElem2level.getCodegruppe_Descr());
                             level1elem.nodeChild().addElement(level2elem);
                             for (int k = j + 1; k < size; k ++)
                                  IE_T_CatalogueElement catalogueElem3level =
                                                           catalogueNode.getE_T_CatalogueElementAt( k );
                                  String level3 = catalogueElem3level.getLevel();
                                  if (level3.equals("3"))
                                       ICatalogoElement level3elem = level2elem.nodeChild().createCatalogoElement();
                                       level3elem.setKATALOGART_CODE(catalogueElem3level.getKatalogart());
                                       level3elem.setCODEGRUPPE_CODE(catalogueElem3level.getCodegruppe());
                                       level3elem.setCODE(catalogueElem3level.getCode());
                                       level3elem.setCODE_DESCR(catalogueElem3level.getCode_Descr());
                                       level3elem.setDESCR(catalogueElem3level.getCode_Descr());
                                       level2elem.nodeChild().addElement(level3elem);
    Damiano

  • Exporting Text data from PHP to Oracle CLOB data (Carriage return - issue)

    This is my original text content in PHP - Data type - Longtext
    SECTION - 1
    This a test description.This a test description.
    This a test description.This a test description.
    This a test description. This a test description.I exported the above content from PHP as a SQL script file (insert into.. ) - export.sql [ insert into table_name (id, text_content) values (1, '') ]
    while exporting data from PHP table into export file.. it replaced the "Carriage return" with "\r\n\r\n" in the insert statement for text_content column
    When I run this INSERT statement in Oracle (for longtext, I have created a CLOB column in Oracle), the following text_content data is inserted into CLOB column in Oracle.
    SECTION - 2
    This a test description.This a test description.\r\n\r\nThis a test description.This a
    test description.\r\n\r\nThis a test description.This a test description.Now I have created a item named P1_TEXT_CONTENT of type TEXTAREA and try to fetch the CLOB data into this page item.
    BUT textarea displays the entire content including "\r\n\r\n" as mentioned in SECTION - 2
    I want to display the content in textarea (item - P1_TEXT_CONTENT) without "\r\n\r\n" same as the original content with "Carriage return" as mentioned in SECTION - 1
    What are the options we have?
    Thanks,
    Deepak

    DeepakJ wrote:
    I want to display the content in textarea (item - P1_TEXT_CONTENT) without "\r\n\r\n" same as the original content with "Carriage return" as mentioned in SECTION - 1
    What are the options we have?Run an update on the Oracle table following the inserts to replace the escaped CR/LFs with real ones:
    update foo
    set clob_column = replace(clob_column, '\r\n', chr(13) || chr(10));You might want to experiment to see which characters are actually necessary. As an OS X/Linux user I'd probably just use a single LF chr(10).

  • How to call PL/SQL function from php

    I have one function define in package,like below
    >>
    create or replace package body Intg$Label_DB as
    Future constant date := to_date ('21990101', 'YYYYMMDD');
    Max_Annotation_Len integer := 3995;
    function Get_Tagged_Label (Product_Name varchar2,Branch_Name varchar2, Platform_Name varchar2, Schema_Name varchar2) return varchar2 is
    Series_Id integer := Get_Series (Product_Name,Branch_Name,Platform_Name);
    Schema_Id integer := Get_Schema (Schema_Name);
    Dep_Label_Id integer;
    Next_Dep_Label_Id integer;
    Result_Id integer;
    Result Intg$Labels.Name%type;
    begin
    select SLT.Dep_Label_Id, SLT.Next_Dep_Label_Id into Dep_Label_Id, Next_Dep_Label_Id
    from Intg$Series_Label_Tags SLT
    where SLT.Series_Id = Get_Tagged_Label.Series_Id and SLT.Schema_Id = Get_Tagged_Label.Schema_Id;
    Result_Id := Next_Dep_Label_Id;
    if Result_Id = -1 then
    Result_Id := Dep_Label_Id;
    end if;
    select L.Name into Result from Intg$Labels L where L.Id = Result_Id;
    return Result;
    exception
    when NO_DATA_FOUND then
    return '';
    end Get_Tagged_Label;
    >>
    i want to call Get_Tagged_Label() from php and print the output,I tried below code but seems i am missing lots of things here.Any help will be appreciate.
    $sql = 'BEGIN INTG$Label_DB.Get_Tagged_Labell(:Product_Name,:Branch_name,:Platform_Name,:message,:message_1,:message_2); END;';
    $stmt = oci_parse($conn,$sql) or die ('Can not parse query') ;
    // Bind the input parameter
    oci_bind_by_name($stmt,':Product_Name',$name,32);
    oci_bind_by_name($stmt,':Branch_name',$branch,32);
    oci_bind_by_name($stmt,':Platform_Name',$pt,32);
    // Bind the output parameter
    oci_bind_by_name($stmt,':message',$message,32);
    oci_bind_by_name($stmt,':message_1',$message_1,32);
    oci_bind_by_name($stmt,':message_2',$message_2,32);
    // Assign a value to the input
    $name = 'PCBPEL';
    $branch ='MAIN';
    $pt ='GENERIC';
    oci_execute($stmt);
    Thanks
    Hridyesh

    What errors are you getting?
    It's always helpful to know the version of PHP and the database.
    When calling a function, you'll need a bind variable to hold the return value, and make sure the number of parameters match:
    $sql = 'BEGIN :rv := INTG$Label_DB.Get_Tagged_Labell(:Product_Name,:Branch_name,:Platform_Name,:message); END;';
    This new variable will need to bound with oci_bind_by_name()
    Have you looked at my free Underground PHP and Oracle Manual at http://www.oracle.com/technology/tech/php/pdf/underground-php-oracle-manual.pdf ? Or any one of the other fine PHP-Oracle books available?

  • Flash Builder 4.5 for PHP - show variable from PHP in app

    I have searched for hours and I can't figure this out…
    Is there a way to somehow "echo" my PHP code in my MXML file ?
    I know you can't echo something from PHP to MXML, so here's what I have done :
    I get my informations from my database, I need to show an image and its title, so I put the following code in a variable :
    <mx:Image id="laniraBlanche" x="25" y="65" width="210" height="126" source="'.$row->image_mini.'" click="selectLaniraBlanche()" rollOver="seePicture()" rollOut="outPicture()" />                                              <s:Label x="25" y="155.85" text="'.$row->nom.'" width="210" textAlign="center" height="37" fontSize="19" backgroundColor="#676666" verticalAlign="middle" fontFamily="Georgia" color="#FFFFFF" click="selectLaniraBlanche()" rollOver="seePicture()"  id="laniraBlancheTxt" rollOut="outPicture()" />'
    Then, I return that variable.
    I find the function where my var created is returned from the "Data/Service" tab, I am on Design mode on Flash Builder, and I "drop" my function where I want my image and text to show on my app.
    I tryed dropping it in a "group", it doesn't show anything. I tryed several other options, and nothing worked.
    So my question is, how could I have this code created in PHP show on my application ?
    Thank you  for your help

    I also have Flash Builder 4.5 for PHP and the ANT view does not show when going to Window -> Show View --> Other.  I could not find it in any of the folders.
    However, I was able to add it by hitting Command 3 (CTRL 3 on PC) and typing Ant.

  • From PHP to JSP for a search-responder.php

    I have been asked to use the "search-as-you-type" solution offered up by Google at [http://code.google.com/p/search-as-you-type/|http://code.google.com/p/search-as-you-type/]. The documentation offered by Google is pretty much straight forward but of course the actual piece of code that gets the data is built in PHP and my client needs this to be used on a page serving up JSP.
    I am learning JSP and moving from PHP and ASP and learning quickly but not quick enough to finish the project.
    Would anyone be able and willing to help me convert the functions in the following PHP code into JSP?
    Thanks in advance to anyone who takes the time to help me.
    <?php
    * Copyright (C) 2006 Google Inc.
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
    *      http://www.apache.org/licenses/LICENSE-2.0
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the License for the specific language governing permissions and
    * limitations under the License.
    * Search-as-you-type sample Ajax responder
      // Adding a cache control so that browsers won't cache Ajax requests
      header("Cache-Control: no-cache");
      header("Content-Type: text/html; charset=UTF-8");
       * Get the sample data from the text file.
       * @return array Loaded data
      function GetData() {
        $data = array();
        $file = file("test-data.txt");
        foreach($file as $record) {
          $record = explode("|", trim($record));
          if (count($record) == 4) { // Ignore invalid lines
            $data[] = $record;
        return $data;
       * Get the results based on user's query.
       * @param string $query Query
       * @param array $data Sample data
       * @return array Result array
      function GetResults($query, $data) {
        $results = array();
        $queryLength = strlen($query);
        foreach ($data as $record) {
          if (substr(strtolower($record[0]), 0, $queryLength) == $query) {
            $result = array();
            $result['name'] = $record[0];
            $result['type'] = $record[1];
            $result['content'] = $record[2];
            $result['moreDetailsUrl'] = $record[3];
            $result['style'] =
              ($query == strtolower($record[0])) ? 'expanded' : 'normal';
            $results[] = $result;
        return $results;
      // Get the data and the query
      $data = GetData();
      $query = strtolower(ltrim($_GET['query']));
      // Build response
      $response = array();
      $response['query'] = $query;
      $response['results'] = GetResults($query, $data);
      if (count($response['results']) == 1) {
        $response['autocompletedQuery'] = $response['results'][0]['name'];
      // Output response
      echo "searchAsYouType.handleAjaxResponse(";
      echo json_encode($response);
      echo ");";
    ?>

    Thanks for your comment Gimbal2.
    I have already been thoroughly surprised at how different JSP is from PHP. I am finding quite hard to wrap my head around the whole process to be honest.
    I am beginning to see that JSP and PHP work in a totally different way than each other.
    I am not technically trying to translate or convert the PHP file as much as I am trying to build a file in JSP that does the same functions. The main functions of the PHP script are commented by Google and should be easily enough re-written in JSP in order to produce similar results.
    Since the output needs to be in a JSON format when passed to the .js file you'd think this would be better suited as a .jsp file as well or even a JAVA Applet, Servlet or even a bean. Since the whole site is already built in JSP for a multitude of other functions it seems likely that adding on more to read data from a source file and send it back to the .JS would be straight forward, but I could be wrong. But again I am not familiar enough with JAVA or JSP (yet) to make heads or tails of this.
    1. // Adding a cache control so that browsers won't cache Ajax requests
    2. * Get the sample data from the text file. @return array Loaded data
    3. * Get the results based on user's query.
    * @param string $query Query
    * @param array $data Sample data
    * @return array Result array
    4. // Get the data and the query
    5. // Build response
    6. // Output response

  • ADF Tree Traversal from one node to its leafs

    Hello,
    after a titanic effort I have been able to add a checkbox next to each node of an adf tree table.
    This checkbox is based on an "helper" entity attribute (not mapped to a column table on the database).
    My next huge problem is to perform an automatic selection of all the checkboxes next to the nodes under the currently selected one.
    For example, if the user checks a checkbox in the second level, then all the checkboxes next to the nodes under that, belonging to level three and four must be checked.
    If this helps, in my case there are at most four levels.
    Up until now I can get all the information from the currently checked node, but I fail to navigate the hierarchy under it for the automatic checking. I think that one problem is to navigate all the rows in the (only) VO the tree is based on. For example, since the tree is not expanded at the beginning, if I iterate on the VO retrieved from the current selected node at the top level, I can't see any rows corresponding to any children. Maybe I just miss something.
    I have followed this example from Frank Nimphius, which only gets the current selected nodes, as I said, but no more. Maybe this is a good starting point, but I need to advance somehow.
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/32-tree-table-from-single-vo-169174.pdf
    Can anyone help?
    Thanks.

    Hi,
    here is a sample of how to search in trees, which actually shows how to traverse trees from a specific node
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/61search-in-rendered-trees-177577.pdf
    Given you have a transient attribute defined, each node (and instance of JUCtrHierNode --> getRow will give you access to the attribute for read/access). Note that because the checkbox is stamped in the context of the tree, upon selecting a parent node, you need to refresh the tree to show the selection state change
    Frank

  • Cannot pass variables from PHP to actionscript 3.0

    I am using CS3 and I write the following code as to pass variable to flash from PHP
    Actionscript
    var myLoader:URLLoader = new URLLoader();
    myLoader.dataFormat = URLLoaderDataFormat.TEXT;
    var myRequest:URLRequest=new URLRequest("http://localhost/moodle/value.php");
    myLoader.load(myRequest);
    myLoader.addEventListener(Event.COMPLETE,onCompleteHandler);
    var myValue: String;
    function onCompleteHandler(e:Event):void{
              var myvariable: URLVariables = new URLVariables(e.target.data);
              myValue = myvariable.values;
                      trace(myValue);
    PHP file
    <?php
       echo ('values = 8');
    ?>
    But I always get the error and cannot get the values by using trace();
    Before i try to use "myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;" I still get the same error.
    Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs
              at Error$/throwError()
              at flash.net::URLVariables/decode()
              at flash.net::URLVariables$iinit()
              at flash.net::URLLoader/flash.net:URLLoader::onComplete()
    Can anyone help me?

    The error is fixed.The new version is like that
    Actionscript
    var myLoader:URLLoader = new URLLoader();
    myLoader.dataFormat = URLLoaderDataFormat.TEXT;
    var myRequest:URLRequest=new URLRequest("http://localhost/moodle/value.php");
    myLoader.load(myRequest);
    myLoader.addEventListener(Event.COMPLETE,onCompleteHandler);
    var myValue: String;
    function onCompleteHandler(e:Event):void{
              var myvariable: URLVariables = new URLVariables(e.target.data);
              myValue = myvariable.values;
                      trace(myValue);
    php file
    <?php
       echo "values=8";
    ?>
    The output finally is "null" in flash file. Why does it happen? It should give me 8 when I input trace(myValue);

  • Special characters in String variable sent from php.

    Hello. Assuming that I send some String variable from php into flash:
    AS3:
    var MyImportedString:String;
    var variables_page_text:URLVariables = new URLVariables();
    var varSend_page_text:URLRequest = new URLRequest("MyPHP.php");
    varSend_page_text.method = URLRequestMethod.POST;
    varSend_page_text.data = variables_page_text;
    var varLoader_page_text:URLLoader = new URLLoader;
    varLoader_page_text.dataFormat = URLLoaderDataFormat.VARIABLES;
    varLoader_page_text.addEventListener(Event.COMPLETE, var_comp_page_text);
    varLoader_page_text.load(varSend_page_text);
    function var_comp_page_text(event:Event):void {
        MyImportedString =  event.target.data.MyVariable;
    php:
    <?php
    header('Content-Type: text/html; charset=utf-8');
    $MyString = "some tekst &";
    print "MyVariable=" . $MyString;
    ?>
       I've noticed that the special character '&' residing inside String, throws an error:  #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.
      My first thought was, it has something to do with html entities, but other entities (like <> or ") don't throw any error. Besides, the use of php functions like htmlentities(); or html_entity_decode(); doesn't make any difference in this case:
    print "MyVariable=" . htmlentities($MyString);
    or
    print "MyVariable=" . html_entity_decode($MyString);
      I've also noticed that characters like '%', '^', '+' don't show up at all;
      What does it mean? Any ideas?
      Reagards.

    Thank You 'moccamaximum'.
    Ok. So here is the solution (php function posted by 'moccamaximum' does the trick):
    AS3:
    var MyImportedString:String;
    var variables_page_text:URLVariables = new URLVariables();
    var varSend_page_text:URLRequest = new URLRequest("MyPHP.php");
    varSend_page_text.method = URLRequestMethod.POST;
    varSend_page_text.data = variables_page_text;
    var varLoader_page_text:URLLoader = new URLLoader;
    varLoader_page_text.dataFormat = URLLoaderDataFormat.VARIABLES;
    varLoader_page_text.addEventListener(Event.COMPLETE, var_comp_page_text);
    varLoader_page_text.load(varSend_page_text);
    function var_comp_page_text(event:Event):void {
        MyImportedString =  event.target.data.MyVariable;
         trace(MyImportedString);        // Output:  some text &%^+
    php:
    <?php
    header('Content-Type: text/html; charset=utf-8');
    $MyString = "some text &%^+";
    print "MyVariable=" . flash_encode($MyString);
    function flash_encode($string){
         $string = rawurlencode(utf8_encode($string));
         $string = str_replace("%C2%96", "-", $string);
         $string = str_replace("%C2%91", "%27", $string);
         $string = str_replace("%C2%92", "%27", $string);
         $string = str_replace("%C2%82", "%27", $string);
         $string = str_replace("%C2%93", "%22", $string);
         $string = str_replace("%C2%94", "%22", $string);
         $string = str_replace("%C2%84", "%22", $string);
         $string = str_replace("%C2%8B", "%C2%AB", $string);
         $string = str_replace("%C2%9B", "%C2%BB", $string);
         return $string;
    ?>

  • How to hide a tree node from the GUI but still keep it in the tree model?

    Hi, All
    I used a JTree in my project in which I have a DefaultTreeModel to store all the tree structure and a JTree show it on the screen. But for some reason, I want to hide some of the nodes from the user, but I don't want to remove them from the tree model because later on I still need to use them.
    I searched on the web, some people suggested method to hide the root node, but that's not appliable to my project because I want to hide some non-root nodes; Some people also suggested to collapse the parent node when there are child to hide, it is not appliable to me either, because there still some other childnodes (sibling of the node to hide) I want to show.
    How can I hide some of the tree node from the user? Thanks for any information.
    Linda

    Here's an example using a derivation of DefaultTreeModel that shows (or does not show) two types of Sneech (appologies to the good Dr Zeus) by overiding two methods on the model.
    Now, there are many things wrong with this example (using instanceof, for example), but it's pretty tight and shows one way of doing what you want.
    Note: to make it useful, you''d have to change the implementation of setShowStarBelliedSneeches() to do something more sophisticated than simply firing a structure change event on the root node. You'd want to find all the star bellied sneech nodes and call fireTreeNodesRemoved(). That way the tree would stay expanded rather than collapse as it does now.
    import javax.swing.JTree;
    import javax.swing.JScrollPane;
    import javax.swing.JOptionPane;
    import javax.swing.JCheckBox;
    import javax.swing.JPanel;
    import javax.swing.tree.TreePath;
    import javax.swing.tree.DefaultTreeModel;
    import javax.swing.tree.DefaultMutableTreeNode;
    import java.awt.Dimension;
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.Enumeration;
    class FilteredTree
         private class PlainBelliedSneech {
              public String toString() { return "Plain Bellied Sneech"; }
         private class StarBelliedSneech {
              public String toString() { return "Star Bellied Sneech"; }
         private class FilteredTreeModel
              extends DefaultTreeModel
              private boolean mShowStarBelliedSneeches= true;
              private DefaultMutableTreeNode mRoot;
              FilteredTreeModel(DefaultMutableTreeNode root)
                   super(root);
                   mRoot= root;
              public Object getChild(Object parent, int index)
                   DefaultMutableTreeNode node=
                        (DefaultMutableTreeNode) parent;
                   if (mShowStarBelliedSneeches)
                        return node.getChildAt(index);
                   int pos= 0;
                   for (int i= 0, cnt= 0; i< node.getChildCount(); i++) {
                        if (((DefaultMutableTreeNode) node.getChildAt(i)).getUserObject()
                                            instanceof PlainBelliedSneech)
                             if (cnt++ == index) {
                                  pos= i;
                                  break;
                   return node.getChildAt(pos);
              public int getChildCount(Object parent)
                   DefaultMutableTreeNode node=
                        (DefaultMutableTreeNode) parent;
                   if (mShowStarBelliedSneeches)
                        return node.getChildCount();
                   int childCount= 0;
                   Enumeration children= node.children();
                   while (children.hasMoreElements()) {
                        if (((DefaultMutableTreeNode) children.nextElement()).getUserObject()
                                            instanceof PlainBelliedSneech)
                             childCount++;
                   return childCount;
              public boolean getShowStarBelliedSneeches() {
                   return mShowStarBelliedSneeches;
              public void setShowStarBelliedSneeches(boolean showStarBelliedSneeches)
                   if (showStarBelliedSneeches != mShowStarBelliedSneeches) {
                        mShowStarBelliedSneeches= showStarBelliedSneeches;
                        Object[] path= { mRoot };
                        int[] childIndices= new int[root.getChildCount()];
                        Object[] children= new Object[root.getChildCount()];
                        for (int i= 0; i< root.getChildCount(); i++) {
                             childIndices= i;
                             children[i]= root.getChildAt(i);
                        fireTreeStructureChanged(this, path, childIndices, children);
         private FilteredTree()
              final DefaultMutableTreeNode root= new DefaultMutableTreeNode("Root");
              DefaultMutableTreeNode parent;
              DefaultMutableTreeNode child;
              for (int i= 0; i< 2; i++) {
                   parent= new DefaultMutableTreeNode(new PlainBelliedSneech());
                   root.add(parent);
                   for (int j= 0; j< 2; j++) {
                        child= new DefaultMutableTreeNode(new StarBelliedSneech());
                        parent.add(child);
                        for (int k= 0; k< 2; k++)
                             child.add(new DefaultMutableTreeNode(new PlainBelliedSneech()));
                   for (int j= 0; j< 2; j++)
                        parent.add(new DefaultMutableTreeNode(new PlainBelliedSneech()));
                   parent= new DefaultMutableTreeNode(new StarBelliedSneech());
                   root.add(parent);
                   for (int j= 0; j< 2; j++) {
                        child= new DefaultMutableTreeNode(new PlainBelliedSneech());
                        parent.add(child);
                        for (int k= 0; k< 2; k++)
                             child.add(new DefaultMutableTreeNode(new StarBelliedSneech()));
                   for (int j= 0; j< 2; j++)
                        parent.add(new DefaultMutableTreeNode(new StarBelliedSneech()));
              final FilteredTreeModel model= new FilteredTreeModel(root);
              JTree tree= new JTree(model);
    tree.setShowsRootHandles(true);
    tree.putClientProperty("JTree.lineStyle", "Angled");
              tree.setRootVisible(false);
              JScrollPane sp= new JScrollPane(tree);
              sp.setPreferredSize(new Dimension(200,400));
              final JCheckBox check= new JCheckBox("Show Star Bellied Sneeches");
              check.setSelected(model.getShowStarBelliedSneeches());
              check.addActionListener(new ActionListener() {
                   public void actionPerformed(ActionEvent e) {
                        model.setShowStarBelliedSneeches(check.isSelected());
              JPanel panel= new JPanel(new BorderLayout());
              panel.add(check, BorderLayout.NORTH);
              panel.add(sp, BorderLayout.CENTER);
              JOptionPane.showOptionDialog(
                   null, panel, "Sneeches on Beeches",
                   JOptionPane.DEFAULT_OPTION,
                   JOptionPane.PLAIN_MESSAGE,
                   null, new String[0], null
              System.exit(0);
         public static void main(String[] argv) {
              new FilteredTree();

  • WD ABAP: selecting a tree node from program and scroll to it

    Hi guys!
    I am using a tree in Web Dynpro ABAP. I would like to select/highlight one node from the coding, without user interaction. Is it possible? I couldn't find any (obvious) way so far...
    If it is possible, then let us go a little bit further. Suppose, that the tree grew so big, that cannot fit in the container. Suppose, that you can scroll the tree up/down to see all the nodes. Now, if you mark one tree node from the coding, is it possible somehow, that you scroll the tree automatically, so that the selected node is visible?
    I am interested in any solutions within WD ABAP.
    If you can only answer one of the questions, that is also appreciated!
    Thanks for the help in advance.
    Best regards,
    Janos Kis
    Aerospace&Defense(ERP)

    Hi Thomas,
    thanks for the advice, it works, I have already tried it. The tree node in the lead selection appears highlighted.
    The scrolling doesn't work, though. I have tried to put the tree in a scroll container, and I have also tried it without (relying on the browser to scroll). Neither of them worked, it doesn't scroll to the selected node, it remains offscreen. Can you think of a way, to bring it automatically within the visible range? Ideas, anyone?
    Actually we would like to implement a search function in the tree, and show the result within the tree (highlight the node, expand, if necessary, and bring it on the screen, if off-screen)
    A negative answer is good enough for me, so that I know, that I can stop looking for a solution. Thanks in advance.
    Janos

  • Insert using Spatial Index fails when called from PHP

    I have a stored procedure that inserts into a table with a spatial index on one of its fields.
    When I run the procedure from SQL Server Management Studio it runs just fine.
    When I run it from PHP, it returns the error: "INSERT failed because the following SET options have incorrect settings: 'CONCAT_NULL_YIELDS_NULL, ANSI_WARNINGS, ANSI_PADDING'. Verify that SET options are correct for use with indexed views and/or indexes
    on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index operations"
    From within Management Studio, I have tried many different combinations of settings, until I wound up with the list I have in the procedure below.
    Within Managment Studio the error changes based on the options I have set, but PHP always replies with: 'CONCAT_NULL_YIELDS_NULL, ANSI_WARNINGS, ANSI_PADDING'
    I have configured PHP to use the same SQL user as management studio, and I have tried both mssql_query and mssql_execute with bound parameters.
    The spatial index is on the field post.location If I remove the spatial index it works, but I need the spatial index.
    CREATE PROCEDURE insert_post ( @subject AS VARCHAR(250), @body AS VARCHAR(2000), @latitude AS FLOAT, @longitude AS FLOAT ) AS BEGIN
    SET NOCOUNT ON
    SET ANSI_WARNINGS ON
    SET ANSI_PADDING ON
    SET CONCAT_NULL_YIELDS_NULL ON
    SET NUMERIC_ROUNDABORT OFF
    DECLARE @location AS geography = geography::Point(@latitude, @longitude, 4326)
    INSERT INTO post
        subject,
        body,
        location
    ) VALUES (
        @subject,
        @body,
        @location
    END

    Hi Charles
    Your issue looks like it have two basic sources: (1) The connection string properties, (2) The table structure and the data which you try to insert.
    (1) The connection string properties can be specified in various ways.
    You can set most of them during the connection, depending on the provider which you are using. We did not get from you any information about the PHP code, so we have no information regarding this part.
    The connection properties can be changed after the connection was made, which is basically what you have try to do. But we don't know what properties
    are differents (since you .. the PHP code..) but you can check those properties dynamically, insert them to a table and then compare. To check all the properties you can use this post:
    http://ariely.info/Blog/tabid/83/EntryId/153/SQL-Server-Get-Connection-Properties.aspx
    (2) We need to understand your
    table structure and compare it to yours query. Please post your DDL+DML (queries to create the table and to insert some sample data), and the full SP code
    as it is now.
    [Personal Site]  [Blog]  [Facebook]

  • How to get Universe Long Name from DataProvider from BO SDK Web XI R3

    In BO 6.5 I was able to query the repository using an Oracle query to get details about the classes, property(s) and property data value(s). I'm using the following query:
    SELECT DISTINCT u.uni_longname, c.cls_name, p.prp_name, p.property_id,
                    d.prp_datavalue
               FROM unv_universe@PRBA u,
                    unv_class@PRBA c,
                    unv_property@PRBA p,
                    unv_prop_data@PRBA d
              WHERE c.universe_id = u.universe_id
                AND c.universe_id = p.universe_id
                AND c.class_id = p.class_id
                AND p.universe_id = d.universe_id
                AND p.property_id = d.property_id
                AND d.prp_datatype = 'W'
           ORDER BY 1, 2
    where PRBA is our BO oracle repository. It would return the following, though I get multiple rows for this query, I am pasting one row only
    UNI_LONGNAME          CLS_NAME            PRP_NAME               PROPERTY_ID      PRP_DATAVALUE
    Accounting Universe   Account Details     Account Option     15                      ACCT.ACCT_ID  IN  @Prompt('ACCOUNT_OPTION','N', ['Account Details\Account ID'],multi,free)
    I'm wondering what is the equivalent methods/objects using BO Java SDK in Webi XI R3 to get the same information. I use the above information to delete the prompts for which user has not provided a value.
    Also I need to know, Is it possible to get Univers Long Name from DataProivder, then from Univers Long Name, will I be able to get the above Records Set? Is this possible in BO SDK Webi XI R3?
    My requirement is, I have BO Prompts and I need to remove certain prompts which are not supplied by the User, for example if I need to remove ACCOUNT_OPTION, I iterate the record set, as long as ACCOUNT_OPTION is there in PRP_DATAVALUE then I would remove the Filter Condition.Can anyone help me out on this? Rightnow This is a show stopper for me.
    Thanks

    Thanks for your reply, NO Java SDK means, what is it not possible? and what is possible through COM SDK?
    my requirement is, I need to remove certain Filter condition for a DataProvider, for example, ACCOUNT_OPTION is the name of the field, but through JAVA SDK, I am getting Account Option ,
    I have been trying the below code, Can anyone help me out what am I doing wrong? I could not go further.
    ACTXTRACTCon is my list of arrays, these prompts have to be removed from BO Prompts. Although I wanted to post my entire code, for some reason I could not embed the code. This code may have some compilation errors.
         // Get Providers from DocumentInstance
                   DataProviders oProviders = oDoc.getDataProviders();
                   int iDataProviderIndex = 0;
                   int iQueryCount = 0;
                   int iQueryIdx = 0;
                   Query oQuery = null;
                   // Declare ConditionContainer
                   ConditionContainer oCC = null;
                   int iCCIndex = 0;
                   FilterConditionNode oFCN = null;
                   ConditionObject oCO = null;
    String ACTXTRACTCon [] ={                    
                   "PRINTER_NAME",
                   "PARTNER_RANK",
                   "PARTNER_DOMICILE",
                   "TO_GL_CYCLE_DT",
                   "ENTITY_OPTION",
                   "LONG_MEMO",
                   "SHORT_MEMO",
                   "ENTITY_TYPE",
                   "POST_END_DT",
                   "TCODE_TYPE",
                   "ACCOUNT_OPTION",
                   "PARTNER_STATUS",
                   "ACCT_TYPE",
                   "POST_BEGIN_DT",
                   "TCODE_OPTION",
                   "FROM_GL_CYCLE_DT",
                   "PARTNER_TYPE"
    while (iDataProviderIndex <= oProviders.getCount()-1){
                        // Get DataProvider from DataProviders
                        DataProvider oProvider = oProviders.getItem(iDataProviderIndex);
                        // Get Query from DataProvider
                        QueryContainer oQuerys = oProvider.getCombinedQueries();
                        System.out.println("oProvider------->"+oProvider);
                        System.out.println("oProvider.getName().."+oProvider.getName());
                        System.out.println("oProvider.getDataSource().getLongName().."+oProvider.getDataSource().getLongName());
                        System.out.println("oProvider.getDataSource().getUniverseID().."+oProvider.getDataSource().getUniverseID());
                        iQueryCount = oQuerys.getChildCount();
                        if (iQueryCount > 0) {                         
                             // Loop through Query to get ConditionObject
                             for (iQueryIdx = 0; iQueryIdx <= iQueryCount - 1; iQueryIdx++) {
                                  oQuery = (Query)oQuerys.getChildAt(iQueryIdx);
                                  oCC = oQuery.getCondition();
                                  if (oCC != null){                              
                                       // Only Leaf object has condition
                                       if (!oCC.isLeaf()){
                                            // Loop through ConditionContainer to get all conditions
                                            int iCCCount = oCC.getChildCount();
                                            int iRevCCIndex = 0;
                                            //Removing universe level conditions
                                            for (iCCIndex = 0; iCCIndex <= iCCCount-1; iCCIndex++){
                                                 iRevCCIndex= iCCCount - iCCIndex -1;
                                                 oFCN=oCC.getFilterConditionNode(iRevCCIndex);
                                                 if (oFCN instanceof ConditionObject) {
                                                      oCO = (ConditionObject)oFCN;
                                                      FilterCondition oOperand=(FilterCondition)oCO.getOperand();
                                                      System.out.println("oOperand.."+oOperand);
                                                      for (int iRow = 0; iRow <= ACTXTRACTCon.length - 1; iRow++){     
                                                           if (oCO.getName().trim().toString().equals(ACTXTRACTCon[iRow])){
                                                                oFCN.remove(oCO);
                                                                break;
                                            // Removing report level conditions
                                            iCCCount = oCC.getChildCount();
                                            for (iCCIndex = 0; iCCIndex <= iCCCount-1; iCCIndex++){
                                                 iRevCCIndex= iCCCount - iCCIndex -1;
                                                 oFCN=oCC.getFilterConditionNode(iRevCCIndex);
                                                 if (oFCN instanceof ConditionObject){
                                                      oCO = (ConditionObject)oFCN;
                                                      FilterCondition oOperand=(FilterCondition)oCO.getOperand();
                                                      if (oOperand != null){
                                                           int iOperandCount = oOperand.getOperandCount();
                                                           int iRevOperandIdx = 0;
                                                           boolean bBreakInd = false;
                                                           for (int iOperandIdx = 0; iOperandIdx <= iOperandCount-1; iOperandIdx++){
                                                                // Removing conditions start with high index
                                                                iRevOperandIdx = iOperandCount - iOperandIdx - 1;
                                                                for (int iRow = 0; iRow <= ACTXTRACTCon.length-1 ; iRow++){                                                                 
                                                                     if (oOperand.getOperand(iRevOperandIdx).toString().equals(ACTXTRACTCon[iRow])){
                                                                          oFCN.remove(oCO);
                                                                          bBreakInd = true;
                                                                          break;
                                                                if (bBreakInd == true){
                                                                     // Exit from loop if condition has been removed
                                                                     break;
                        // fetch the changes
                        oProvider.runQuery();
                        iDataProviderIndex++;
                        System.out.println("Data Provider Index = " + iDataProviderIndex);
    Thanks
    Gokul.
    Edited by: mgggkn on Jul 11, 2011 8:18 PM

Maybe you are looking for