1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Gantt Chart in ASP trouble

Discussion in 'ASP' started by help, Feb 9, 2006.

  1. help

    help New Member

    Joined:
    Feb 8, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Hallo,
    Sorry but i want to ask about gantt chart in asp,
    why from my code in asp is wasting time and make connetion timeout,
    is a cut from my code, have you some solution to me.
    i use Oracle database, and the memory server is 4Gbytes
    thanks

    tglawal=fun_tgl_awal(vartahun,varblnawal)
    tglakhir=fun_tgl_akhir(vartahun,varblnakhir)

    Response.Write("<span class='style11'>"&varkd_mesin_ip&" Periode : "&lblbulan(varblnawal)&"-"&lblbulan(varblnakhir)&" "&vartahun&"<br></span>")

    'ini buat next yang dibawah
    test=cint(tglakhir-tglawal)
    for x=0 to test

    for li = 0 to 1440 step 1
    test_tglx=dateadd("s",li*60,tglawal)


    if is_true(test_tglx,"P") then
    Response.Write("<td bgcolor='#FFFF00'><img src='bgsm.gif' height='5' width='1'></td>")
    'Response.Write("<td bgcolor=yellow>-</td>")
    else
    Response.Write("<td bgcolor='#CCCCCC'><img src='bgsm.gif' height='5' width='1'></td>")
    end if
    next
    response.Write("</tr>")

    tglawal=dateadd("d",1,tglawal)
    next

    function is_true(tglwaktu,state)
    if line > 0 then
    for slot_state=1 to line
    if slot_state<line then
    if ( array_sm(1,slot_state) = state) and (array_sm(2,slot_state) <= tglwaktu) and (tglwaktu <= array_sm(2,slot_state+1)) then
    is_true = true
    exit for
    else
    is_true = false
    end if
    else
    if ( array_sm(1,slot_state) = state) and (array_sm(2,slot_state) <= tglwaktu) then
    is_true = true
    exit for
    else
    is_true = false
    end if
    end if
    next
    else
    is_true = false
    end if
    end function

    function fun_tgl_awal(tahun,bulanawal)
    fun_fun_tgl_awal=cdate(bulanawal&"/1/"&tahun&" 00:00")
    end function

    function fun_tgl_akhir(tahun,bulanakhir)
    fun_fun_tgl_akhir=cdate(bulanakhir&"/"&lbllentgl(bulanakhir)&"/"&tahun&" 23:59")
    end function
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    I have moved your thread to the Queries and expert comments section from Codes and Project Section

    Also I have formated your code so that its easy to understand. You can also use the bbcode to do the same

    Code:
    tglawal=fun_tgl_awal(vartahun,varblnawal)
    tglakhir=fun_tgl_akhir(vartahun,varblnakhir) 
    
    Response.Write("<span class='style11'>"&varkd_mesin_ip&" Periode : "&lblbulan(varblnawal)&"-"&lblbulan(varblnakhir)&" "&vartahun&"<br></span>") 
    
    'ini buat next yang dibawah
    test=cint(tglakhir-tglawal)
    for x=0 to test
    
    for li = 0 to 1440 step 1
    test_tglx=dateadd("s",li*60,tglawal)
    
    
    if is_true(test_tglx,"P") then 
            Response.Write("<td bgcolor='#FFFF00'><img src='bgsm.gif' height='5' width='1'></td>")
            'Response.Write("<td bgcolor=yellow>-</td>")
    else
            Response.Write("<td bgcolor='#CCCCCC'><img src='bgsm.gif' height='5' width='1'></td>")
    end if
    next
    response.Write("</tr>")
    
    tglawal=dateadd("d",1,tglawal)
    next
    
    function is_true(tglwaktu,state)
    if line > 0 then
            for slot_state=1 to line 
                    if slot_state<line then
                            if ( array_sm(1,slot_state) = state) and (array_sm(2,slot_state) <= tglwaktu) and (tglwaktu <= array_sm(2,slot_state+1)) then
                                    is_true = true
                                    exit for
                            else
                                    is_true = false
                            end if
                    else
                            if ( array_sm(1,slot_state) = state) and (array_sm(2,slot_state) <= tglwaktu) then
                                    is_true = true
                                    exit for
                            else
                                    is_true = false
                            end if
                    end if
            next
    else
            is_true = false
    end if
    end function
    
    function fun_tgl_awal(tahun,bulanawal)
    fun_fun_tgl_awal=cdate(bulanawal&"/1/"&tahun&" 00:00")
    end function
    
    function fun_tgl_akhir(tahun,bulanakhir)
    fun_fun_tgl_akhir=cdate(bulanakhir&"/"&lbllentgl(bulanakhir)&"/"&tahun&" 23:59")
    end function
    
     
  3. coderzone

    coderzone Super Moderator

    Joined:
    Jul 25, 2004
    Messages:
    734
    Likes Received:
    37
    Trophy Points:
    0
    It looks like the problem is in the following statement
    Code:
    for slot_state=1 to line 
    You are looping it from 1 to a variable line which is not defined or initilized so probably it loops infinitely and then terminates.
     
  4. help

    help New Member

    Joined:
    Feb 8, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    sorry line from this code
    line show how many row in the select execution,
    thanks

    do while(not rs.eof)
    line=line+1
    rs.movenext
    loop
     
  5. help

    help New Member

    Joined:
    Feb 8, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    Sorry again,
    I have problem to with gantt chart i made, when I close IE, my IE have error why?
    thanks
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
    Code:
    do while(not rs.eof)
    line=line+1
    rs.movenext
    loop
    But you havent done that on the page code and so it should be infinte.

    Also what error you get in IE. If its your IE causing the problems try getting FireFox
     

Share This Page