How to use recursive in this case?

I have a tree showed in bweb rowser UI like this
+- node1          
| |
| +- node_value1a    X 
| +- node_value1b     
| +- node_value1c      X
|
+- node2    X      
| |
| +- node2a      X
| | |
| | +- node_value2a1   X
| | +- node_value2a2   X
| |
| +- node_value2b     X  
|
+- node3          
|
+- node_value3a    X 
+- node_value3b     
At the begining I will retrieve the user permission for each node value and show them as checked "X" , Each node have a biding userObject with property key and check status and other more(we will focus on node key name and check status only). The parent node will be calculated as checked only if all its children are checked. So every time user click one node or node value(node without children). I will re-calculate the all tree nodes status based on all node_value again and update all check box in UI page. This seems need to go from bottum up since I will do:
. Upon the clicking of one node(can be any node) I will send a http request back to server with that node key name. I will then do the following:
if it is uncheck requrest -> updated all its childrens as unchecked -> recalculate all its parent to update their check status to unchecked
if it is check requrest -> updated all its children as checked -> recalculate all its parent to update their check status.(may be check or uncheck depend on other sibling node status).
The porpuse is to update that user's access right.
I get lost when I try coding this feature. Could sonebody here help me out ? Thanks

So how far have you got so far?

Similar Messages

  • How to use to_date for this case?

    Hi,
    I bind parameters in java code.
    The param type in java is Timestamp and the data type in table is date.
    Here is the sql section printted in log:
    2004-08-01 10:00:00.0 <= table.datetime
    Why there is a ".0" after second?
    And how to use to_date to convert "2004-08-01 10:00:00.0"?
    Thanks!

    Hi,
    Here are a few possibilities
    SQL> select cast(timestamp '2004-08-01 10:00:00.0' as date) from dual;
    CAST(TIMESTAMP'2004
    2004-08-01 10:00:00
    SQL> select to_date('2004-08-01 10:00:00.0','YYYY-MM-DD HH24:MI:SS".0"') from dual;
    TO_DATE('2004-08-01
    2004-08-01 10:00:00
    SQL> select to_date(substr('2004-08-01 10:00:00.0',1,19), 'YYYY-MM-DD HH24:MI:SS') from dual;
    TO_DATE(SUBSTR('200
    2004-08-01 10:00:00

  • How to use LIKE in this CASE?

    There are multiple values that start with "Aerospace".  All of them are going to be set to the same value.  I'm trying to write a Case Statement that will replace all of them with the new value, but i can't get the LIKE to work correctly.
      This can probably be done with REPLACE, but It's bugging me that I can't get the LIKE to work.  
    I've tried a few variations, but compiler hasn't like any of them.  I'm hoping to have one line of code that will work for all of the possible choices.
    What is the best way to use a LIKE or similar thing (such as CONTAINS) to set all of the fields with "Aerospace" at the beginning?
    Sorry for the small font above.  I didn't see how to change it.
    'New Sector Focus' = CASE sectorfocus
    WHEN sectorfocus LIKE 'Aerospace%' THEN '201010 - Aerospace & Defense'
    ELSE sectorfocus
    END

    CASE expression looks good. CASE blog: 
    http://www.sqlusa.com/bestpractices/training/scripts/casefunction/
    >Sorry for the small font above.  I didn't see how to change it.
    Use the HTML icon to edit the html code.
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • How to use counter in this case

    in my selection screen i have billing doc no-vbeln.
    in my ztable i have etimes a field.
    when i enter a bill doc no and press f8, my etimes feild in ztable sets to 1.
    my requirement is if i enter a bill doc as 97600654 for first time, etimes is 1.
    for second time if i enter that same bill doc i.e 97600654 , etimes should be 2 and if third then 3 and so on.
    if a new doc is entered then etimes is again 1.
    how to code this..plz provide some code.

    Hi Rudra,
    First You need to create a Ztable(say ZTT_VBELN_COUNT) with Three fields MANDT VBELN ETIMES.
    Now in your program add code as below;
    DATA wa_vbeln_count type line of ZTT_VBELN_COUNT.
    SELECT SINGLE * FROM ZTT_VBELN_COUNT INTO CORESSPONDING FIELDS OF wa_vbeln_count where VBELN = lv_vbeln.
    IF SY-SUBRC EQ 0.
       wa_vbeln_count-etimes = wa_vbeln_count-etimes + 1.
    ELSE
       wa_vbeln_count-vbeln = lv_vbeln.
       wa_vbeln_count-etimes = 1.
    ENDIF.
    MODIFY ZTT_VBELN_COUNT FROM wa_vbeln_count.
    Regards
    Karthik D

  • Oracle:how to use max() function in case expression

    how to use max() function in case expression, Please explain with any example

    Hope this helps and should be self explanatory
    with t as
    (select 1 col,100 col2 from dual union
    select 2 ,100 from dual union
    select 2 ,200 from dual union
    select 3,100  from dual union
    select 3,200  from dual  )
    select col, case when max(col2)=100 then 'with 100 range'
    when  max(col2)=200 then 'with 200 range' end  from t group by col

  • How to use two split this method in my code

    How to use two split this method in my code
    if i got one string line which like this
    ("aa!bb!cc~ab!bc!cd") a
    nd want to use two split to spare ! and ~ this seal for my spare point how that output
    has come diff ?
    public static void main(String[] args) {
        String str = "aa!bb!cc~ab!bc!cd";
        String strs[]= str.split("~");
        String strE[]= str.split("!");
        int count =0;
        for(int j=0; j < strs.length; j++){
          for (int i = 0; i < strE.length; i++){   
              System.out.println(count + " " + strE);
    count++;
    the output how can it be like this
    0 aa
    0 bb
    0 cc
    1 ab
    1 bc
    1 cd

    Move your second slit inside the first loop, so you are splitting the substring, not the entire string.

  • HOW TO use DBDataSource in this situation?

    hi all,
      I add a Matrix on system Form(eg:BOM Form),then I want to use Matrix.LoadFromDataSource() to load data.
    the simple code is :
    SAPbobsCOM.Recordset oRecordset = (SAPbobsCOM.Recordset)SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                oRecordset.DoQuery("select ItemCode,ItemName from OITM ");
                SAPbouiCOM.Matrix oMatrix = (SAPbouiCOM.Matrix)m_SboForm.Items.Item("MatrixFormUID").Specific;
                    SAPbouiCOM.DBDataSource oDBData = m_SboForm.DataSources.DBDataSources.Item("tablename");//this dbdatasource is added before
                    oDBData.Clear();//error occur in this code:Operation is not supported in system Form
                    oRecordset.MoveFirst();
                    while (!oRecordset.EoF)
    oMatrix.LoadFromDataSource();
    how to use LoadFromDataSource() in this situation?if evaluate every control,the speed is too slow.
    thanks

    The quick way is as I wrote you - bind it to datasource (you fill it cell by cell). The code is something like:
    omatrix.Clear()
    oColumn = oColumns.Item("Column name 1")
    oColumn.DataBind.SetBound(True, "table name", "itemcode")
    oColumn = oColumns.Item("Column name 2")
    oColumn.DataBind.SetBound(True, "table name", "itemname")
    oMatrix.LoadFromDataSource();
    There isn`t necessary the while (!oRecordset.EoF) cycle

  • Javascript error on - Help - Learn how to use Numbers with this online...

    I am trying to find out more about Numbers. I am using iTunes 9.1.1 on a Vista PC. I get a Javascript error in Internet Explorer 8 when I try to access:
    Help - Learn how to use Numbers with this online resource.
    http://help.apple.com/numbers/1.0
    The link redirects to the following page:
    http://help.apple.com/iwork/safari/interface/#tan727163ed
    The above page is blank except for boxes for Keynote Help, Pages Help, Numbers help, and a blank input field that seems to do nothing. Here is the Javascript error message from Internet Explorer 8:
    Webpage error details
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
    Timestamp: Tue, 1 Jun 2010 20:55:54 UTC
    Message: This command is not supported.
    Line: 1
    Char: 41589
    Code: 0
    URI: http://help.apple.com/iwork/safari/interface/javascript.js

    Link also does not work for me in WIN 7 with IE8. However, it does work in Chrome in WIN 7. It also works in Safari on my G4. Suggest you try Chrome or it may work in another browser like FireFox or Safari in Vista.

  • How to use recursive in Information Design Tools?

    Hi all,
    I want to use recursive for count number of employee in each organization. I write code something like this.
    with EmpCTE as
          select RootID = D.ORG_CD , D. ORG_CD, D .ParentOID
          from  (SELECT     CURRENT_LEAF as ORG_CD ,
                   D .DATE_KEY AS DateKey,
                        CASE WHEN LEAF_LEVEL = 1 THEN LEVEL0
                                   WHEN LEAF_LEVEL = 2 THEN LEVEL1
                                   WHEN LEAF_LEVEL = 3 THEN LEVEL2
                                   WHEN LEAF_LEVEL = 4 THEN LEVEL3
                                   WHEN LEAF_LEVEL = 5 THEN LEVEL4
                                   WHEN LEAF_LEVEL = 6 THEN LEVEL5
                        END AS ParentOID
           FROM [BISIPH_HR]. [dbo].[ORG_HIER_STD] H , MST_DATE_DIM D
           where 1= 1
           and D. DATE_KEY between BEGDA and ENDDA
           and D. DATE_KEY between C_L1_BEGDA_KEY and C_L1_ENDDA_KEY
           and D. DATE_KEY between C_L2_BEGDA_KEY and C_L2_ENDDA_KEY
           and D. DATE_KEY between C_L3_BEGDA_KEY and C_L3_ENDDA_KEY
           and D. DATE_KEY between C_L4_BEGDA_KEY and C_L4_ENDDA_KEY
           and D. DATE_KEY between C_L5_BEGDA_KEY and C_L5_ENDDA_KEY
           and D. DATE_KEY between C_L6_BEGDA_KEY and C_L6_ENDDA_KEY
           and D. DATE_KEY between C_L7_BEGDA_KEY and C_L7_ENDDA_KEY
           )   D
          where 1= 1
          AND DateKey = 20140101
          union all
          select EmpCTE. RootID, D .ORG_CD, D.ParentOID
          from (
            SELECT   CURRENT_LEAF as ORG_CD,
                   D .DATE_KEY AS DateKey,
                        CASE WHEN LEAF_LEVEL = 1 THEN LEVEL0
                                   WHEN LEAF_LEVEL = 2 THEN LEVEL1
                                   WHEN LEAF_LEVEL = 3 THEN LEVEL2
                                   WHEN LEAF_LEVEL = 4 THEN LEVEL3
                                   WHEN LEAF_LEVEL = 5 THEN LEVEL4
                                   WHEN LEAF_LEVEL = 6 THEN LEVEL5
                        END AS ParentOID
           FROM [BISIPH_HR]. [dbo].[ORG_HIER_STD] H , MST_DATE_DIM D
           where 1= 1
           and D. DATE_KEY between BEGDA and ENDDA
           and D. DATE_KEY between C_L1_BEGDA_KEY and C_L1_ENDDA_KEY
           and D. DATE_KEY between C_L2_BEGDA_KEY and C_L2_ENDDA_KEY
           and D. DATE_KEY between C_L3_BEGDA_KEY and C_L3_ENDDA_KEY
           and D. DATE_KEY between C_L4_BEGDA_KEY and C_L4_ENDDA_KEY
           and D. DATE_KEY between C_L5_BEGDA_KEY and C_L5_ENDDA_KEY
           and D. DATE_KEY between C_L6_BEGDA_KEY and C_L6_ENDDA_KEY
           and D. DATE_KEY between C_L7_BEGDA_KEY and C_L7_ENDDA_KEY
           ) D
          inner join EmpCTE on D .ParentOID = EmpCTE.ORG_CD
          AND D. DateKey = 20140101
    select distinct
    ORG_DIM.ORG_CD
    , ORG_DIM. ORG_DESC_T
    , EmpCTE. ParentOID
    --, EMP_DIM.EMP_CODE
    , cnt. Child
    , cntemp. ChildEmp
    from MST_EMP_DIM EMP_DIM
    INNER JOIN TXT_EMP_ORG_FACT EMP_ORG_FACT ON EMP_ORG_FACT .EMP_KEY = EMP_DIM.EMP_KEY
    INNER JOIN MST_ORG_DIM ORG_DIM ON ORG_DIM .ORG_CD = EMP_ORG_FACT.ORG_CD
    INNER JOIN EmpCTE ON EmpCTE .ORG_CD = ORG_DIM.ORG_CD
    INNER JOIN TXT_EMPLOYMENT_FACT EMPLOYMENT_FACT ON EMPLOYMENT_FACT.EMP_CODE_KEY = EMP_ORG_FACT.EMP_CODE_KEY
    INNER JOIN (
           SELECT ORG_CD = RootID, Child = COUNT (*)
           FROM EmpCTE
           GROUP BY RootID
    ) cnt ON cnt.ORG_CD = EMP_ORG_FACT. ORG_CD ------------------ ¹Ñº¨Ó¹Ç¹ ORG ·ÕèÍÂÙèãµé ORG »Ñ¨¨ØºÑ¹
    INNER JOIN (
           SELECT ORG_CD = RootID, ChildEmp = Count (*)
           FROM EmpCTE
           INNER JOIN TXT_EMP_ORG_FACT EMP_ORG_FACT ON EmpCTE .ORG_CD = EMP_ORG_FACT.ORG_CD
           INNER JOIN MST_EMP_DIM EMP_DIM ON EMP_ORG_FACT .EMP_KEY = EMP_DIM.EMP_KEY
           INNER JOIN TXT_EMPLOYMENT_FACT EMPLOYMENT_FACT ON EMPLOYMENT_FACT.EMP_CODE_KEY = EMP_ORG_FACT.EMP_CODE_KEY
           WHERE 1= 1
           AND 20140228 BETWEEN EMP_ORG_FACT.ORG_ASSIGN_START_DT_KEY AND ORG_ASSIGN_END_DT_KEY
           AND 20140228 BETWEEN EMP_DIM.EMP_START_DATE_KEY AND EMP_DIM.EMP_END_DATE_KEY
           AND 20140228 BETWEEN EMPLOYMENT_FACT.START_DATE_KEY AND EMPLOYMENT_FACT.END_DATE_KEY
           AND EMP_ORG_FACT. EMP_ASSIGN_PAYROLL_AREA_CD IN ('Z1', 'Z2')
           AND EMPLOYMENT_FACT. EMPLOYMENT_STATUS_KEY = 3
           GROUP BY RootID
    ) cntemp ON cntemp.ORG_CD = EMP_ORG_FACT. ORG_CD
    WHERE 1= 1
    AND 20140228 BETWEEN EMP_ORG_FACT.ORG_ASSIGN_START_DT_KEY AND ORG_ASSIGN_END_DT_KEY
    AND 20140228 BETWEEN EMP_DIM.EMP_START_DATE_KEY AND EMP_DIM.EMP_END_DATE_KEY
    AND 20140228 BETWEEN EMPLOYMENT_FACT.START_DATE_KEY AND EMPLOYMENT_FACT.END_DATE_KEY
    AND EMP_ORG_FACT. EMP_ASSIGN_PAYROLL_AREA_CD IN ('Z1', 'Z2')
    AND EMPLOYMENT_FACT. EMPLOYMENT_STATUS_KEY = 3
    ORDER BY EmpCTE.ParentOID
    and result
    I want to create ChildEmp object for display in web-i report. How can i use recursive in Information Design Tools? or Do you have other solution for this?
    Thank you for your advise.
    Notto Zung

    Hi,
    NoDim is a function of the Bex query formula ,  so you can't delegate that to the cube.
    What object is, and what are you trying to do.   For example,  Sales, and trying to leave out Currency attribute.
    You can do an awdful of customizing  in a Business Layer or Data Foundation,  that is where your solution where probably come from.
    Regards,
    H

  • How to use Compare and Swap (CAS) atomic function(Solaris specific) in C

    Hi,
    I have found cas32() atomic function in (solaris 10) </usr/include/sys/atomic.h> (and also there is another atomic.h header file in </usr/include/atomic.h> but this header file does not have any cas32() function declarations) the declaration of cas32 in <sys/atomic.h>
    is as follows
    extern uint32_t cas32(uint32_t *target, uint32_t cmp, uint32_t newval);
    extern ulong_t caslong(ulong_t *target, ulong_t cmp, ulong_t newval);
    extern uint64_t cas64(uint64_t *target, uint64_t cmp, uint64_t newval);
    extern void casptr(void target, void cmp, void newval);
    extern uint8_t cas8(uint8_t *target, uint8_t cmp, uint8_t newval);
    But the problem is when iam using these functions in c programs and compiling
    using gcc it is showing the following error.
    Undefined first referenced
    symbol in file
    cas32 /var/tmp//ccQcsnev.o
    And if i use the function other than cas32 group of instruction
    such as atomic_or_uint()
    whose declaration is extern void atomic_or_uint(uint_t *target, uint_t bits);
    in <sys/atomic.h> it is giving no error where as for CAS32 it showing as undefined symbol.Why it is giving like that we are not able to know.Is it the case that CAS32 instruction only available in Kernel mode and not available to user mode.Please inform us if anyone knows how to use cas32() instruction in the user C programs.As this is usefull for writing Nonblocking versions of stacks and Queues.Is there any way to write
    our own atomic functions?
    Rama

    You are trying to use the old kernel-only CAS functions, use the correct ones like:
    atomic_cas_32.
    DS

  • Not too sure how to use Recursion

    Hello, for my assignment I have to use recursion, I have to divide the frame into 4 parts, placing different images in the top right, bottom right, and bottom left portions. The top left part is supposed to be divided into 4 parts and have the same thing done to it, as have the three images again and the top left divided into four parts. Anyone know how I can get a start on this? Any suggestions would be appreciated.

    Ok, I have a main and a Picture Panel. Here is what I have so far. I got three pictures positioned correctly, I just have no idea how the top left part is going to work.
    import java.awt.*;
    import javax.swing.*;
    public class PicturePanel extends JPanel
        private Image _mugen, _jin, _fuu;  // declare the images
        public PicturePanel ()  // constructor
            _mugen = new ImageIcon("mugen.jpg").getImage();  // instantiate the image
            _jin = new ImageIcon("jin.jpg").getImage();  // instantiate the image
            _fuu = new ImageIcon("fuu.jpg").getImage();  // instantiate the image
        public void paint(Graphics g)  // draw the images and bounding boxes
            g.drawImage(_mugen, this.getWidth()/2, 0, this.getWidth()/2, this.getHeight()/2, null);  // draw the _mugen image
            g.drawImage(_jin, this.getWidth()/2, this.getHeight()/2, this.getWidth()/2, this.getHeight()/2, null);  // draw the _jin image
            g.drawImage(_fuu, 0, this.getHeight()/2, this.getWidth()/2, this.getHeight()/2, null);  // draw the _fuu image
    }

  • Preventing SQL injection - can't use cfqueryparam in this case

    Hello. I have a form with a checkbox next to each row.  If the user checks some boxes, then clicks the "Delete" button, I want to execute the following query, but I want to protect it from sql injection attacks:
        <cfquery datasource="#application.mainDS#">
            delete userMessages
            where messageID in (#form.messageID#)
        </cfquery>
    As written above, it works fine.  But if I try to protect this code with <cfqueryparam value="#form.messageID#" cfsqltype="cf_sql_varchar">, I get this error: "Conversion failed when converting the varchar value '7,21' to data type int" (7 and 21 are the messageID's to be deleted).  Obviously the comma prevents conversion to an integer.
    If I use cfsqltype="cf_sql_integer", then the string gets converted to a single integer (in this case 40015, which is nonsense).
    I tried passing form.messageID to a stored procedure, but I seemed to have the same problem there.  I could run the query in a loop where I just delete one row at a time, but I'd like to run just one query if I can do it safely.  Any ideas?
    Thanks.
    PK

    I agree that you should not do an SQL "DELETE" from a web page.  Instead, use "soft deletes," where you contrive for there to be a deleted_flag (boolean), and maybe deleted_by (varchar) and deleted_timestamp.  Then create an SQL "VIEW" which automagically omits the "deleted" records.
    It is also a very good idea to refer to the records using a nonsensical, made-up "moniker" instead of actual record-IDs.  You see, "if I am a nasty person and I know that there is a record #123456, then I'll bet I know the record-IDs of 123,455 other records, too."  But if you refer to the record as "QZB0E9S" and the next record-id in the list is "4Q_9RJPEM2" then it won't take me long to realize that I can't get too far, not even by brute-force.  (And if I see that the record-IDs seem to have verification tags, like "QZB0E9S:4E396", then I know that I am really scroo'd in my hacking-attempt because even if I did somehow million-monkeys my way into a valid record-ID, I've got no earthly idea how to come up with the tag.
    It pays to code defensively, like this.  And it doesn't really take more time.  Without question, always use <cfqueryparam> !!

  • How to use Substring function with Case statement.

    Hello Everyone,
    I have one requirement where I have to use substring function on the field for report criteria.
    E.G.
    I have Branch Name Field where I have all branch names information, Now some of the branch names are too big with some extension after the name .
    now i want to substing it but the character length varies for each branch.
    so is there any way where we can use case statement where we can define that if branch name character are exceeding some value then substing it with this length.

    Try something like this:
    CASE WHEN LENGTH(tablename.Branch_Name) > n THEN SUBSTRING(...) ELSE tablename.Branch_Name END
    where n is the number of characters you want to start the break.

  • Will it feasable to use Module in this case :screen shot attached

    Hi ,
    We are developing a Application which provides several facilities like Forum , Remote User , --- etc screen shot attached for this reference .
    Please tell me will it feasable to develop each of this service as a Module ??
    Please tell me shall we go for seperate Modules or for Seperate Components , what will be feasable
    Please share your experience

    Anybody please tell me if its better to go using Modules Approach , in case if they were part of the Application itself .
    Thanks.

  • How to use classloader in this way? Is it possible?

    I have one my own classlaod. So, I can do these: use the classloader to load the class, use the class's newInstance method to get instance object, then use reflection to invoke methods of the object.
    I think this is the standard way.
    However, it is not convenient. Is there a way that allows me to using the class that loaded by my own classload in "old way", i.e. just new to get object, and directly use it. For example, like this:
    ..Get classloader
    class MyClass = loadClass("MyClass");
    MyClass obj = new MyClass();
    obj.someMethod();
    If this way is possible, it is much better. In theory, it should have no problem. I think Java Web Start, etc are just doing similar like this. But, at this point, I do not know. Please share your thoughts.

    You have to distinguish between compile time, and run time features available to you.
    MyClass x = new MyClass() ; is a language construct that is available at compile time.
    Reflection is available at runtime.
    If you want a mix of both, you may have to generate code. Depending on how you like it - you can either generate source and compile it, or generate byte code directly. But since you seem to be interested more in simplifying your code, due to the relative obscurity of reflective code, your best option would be to use a code generator.
    So use your classloader to load the class, then generate and compile code to use it. (This may be even more complex, but this is how you would have to do it)

Maybe you are looking for