Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Concurrent Updates of status not working
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Concurrent Updates of status not working

 Post Reply Post Reply
Author
simflex View Drop Down
Groupie
Groupie
Avatar

Joined: 10 November 2002
Location: United States
Status: Offline
Points: 63
Post Options Post Options   Thanks (0) Thanks(0)   Quote simflex Quote  Post ReplyReply Direct Link To This Post Topic: Concurrent Updates of status not working
    Posted: 17 April 2003 at 1:39pm

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<html>
<head>
<script language="javascript">
<!--
var numOfBoxes = 8;
function enable(inBox) {
if (!document.forms['myForm']['cb' + inBox].checked) {
// If the user unchecked a box, then disable all after it
for (var i = inBox + 1; i <= numOfBoxes; i ++) {
document.forms['myForm']['cb' + i].checked = false;
document.forms['myForm']['cb' + i].disabled = true;
}
}
else {
// User checked a box, so enable the next
document.forms['myForm']['cb' + (inBox+1)].disabled = false;
}
}
//-->
</script>

<script language="javascript">
<!--
function updateCookie()
{
document.forms['myForm']['cb' + inBox]=document.forms['myForm']['cb' + i].checked.value
location.reload(true)
}
//-->
</script>

</head>
<body>
<%
Set DataConnection = Server.CreateObject("ADODB.Connection")
DataConnection.Open "dsn=aqaqas"

ProjectID = Request.QueryString("Project_ID")
competestatus = "Completed"
    sql = "SELECT * FROM tblStatus WHERE tblStatus.StatusName = '"&competestatus&"'"
    set statusset = DataConnection.execute(sql)
        if not statusset.eof then
            compstatusid = statusset("StatusID")
        end if
        statusset.close
        set statusset = nothing

    sql = "SELECT tblProjectTasks.TaskID, tblProjectTasks.Project_id, tblProjectTasks.StatusID "
    sql = sql & " FROM tblProjectTasks WHERE tblProjectTasks.Project_ID = "&ProjectID&""
    sql = sql & "AND tblProjectTasks.StatusID <> "&compstatusid&""
    set projectset = dataconnection.execute(sql)
    if not projectset.eof then
%>

<%
FUNCTION SortArray(varArray)
    For i = UBound(varArray) - 1  To 1 Step - 1
        MaxVal = varArray(i)
        MaxIndex = i

        For j = 0 To i
            If varArray(j) > MaxVal Then
                MaxVal = varArray(j)
                MaxIndex = j
            End If
        Next

        If MaxIndex < i Then
            varArray(MaxIndex) = varArray(i)
            varArray(i) = MaxVal
        End If
    Next
    'response.write "array sort complete"
END FUNCTION

SQL = "SELECT * FROM tblProjects WHERE tblProjects.Project_id = "&ProjectID&""
set RS = DataConnection.Execute(sql)

if not RS.EOF then
    ProjName = RS("projName")

end if
RS.Close
set RS = nothing

val = request.form("val")

if val = "yes" then
    redim arrSORT(8)
    tasknum = 0
    arraycount = -1
    for each item in request.Form
        if item = "val" or item = "btnUpdate" or item = "txtTaskCode"  or item = "txtIssues" or item = "txtDailyNotes" or item = "txtEndDate" or item = "txtPR_Percent" or item = "txtstatus" then
        else
        ptaskID = Right(item, 1)
        arrSORT(tasknum) = int(ptaskID)
        tasknum = tasknum + 1
        arraycount = arraycount + 1
        end if
    next

        ReDim Preserve arrSORT(arraycount + 1)
            SortArray arrSORT
            ReDim Preserve arrSORT(arraycount)
                currenttaskarryposition =  Ubound(arrSORT)
                currenttask = arrSORT(currenttaskarryposition)

    txtIssues = request.form("txtIssues")
    txtDailyNotes = request.form("txtDailyNotes")
    txtPR_Percent = request.form("txtPR_Percent")
    txtstatus = request.form("txtstatus")

    thissql = "SELECT * FROM tblStatus where tblStatus.StatusID = "&txtstatus&""
    set statusset = DataConnection.execute(thissql)
    StatusName = statusset("StatusName")
    statusset.close
    set statusset = nothing
    set UpdateSet = Server.CreateObject("ADODB.RecordSet")
    UpdateSet.Open "SELECT * FROM tblProjectTasks WHERE tblProjectTasks.Project_id = "&ProjectID&" AND tblProjectTasks.TaskID = "¤ttask&"", DataConnection, 2, 2, &H0001

    if not UpdateSet.eof then
        projectTaskID = updateset("ProjectTaskID")
        thecurrentstatus = UpdateSet("StatusID")
        if thecurrentstatus <> txtstatus then
        UpdateSet("StatusID") = txtstatus
        if competestatus = StatusName then
        UpdateSet("DateCompleted") = now()

        end if

        UpdateSet.Update
        UpdateSet.close
        end if

    end if

    if int(txtstatus) = int(compstatusid) then

    nextptaskID = currenttask + 1
    set UpdateSet = Server.CreateObject("ADODB.RecordSet")
    UpdateSet.Open "SELECT * FROM tblProjectTasks WHERE tblProjectTasks.Project_id = "&ProjectID&" AND tblProjectTasks.TaskID = "&nextptaskID&"", DataConnection, 2, 2, &H0001

    if not UpdateSet.eof then
        curentstatus = Updateset("StatusID")
        nexttaskstatusID = curentstatus + 1
        UpdateSet("StatusID") = nexttaskstatusID

        Updateset("StartDate") = now()

        UpdateSet.Update
        UpdateSet.close
    else
        set UpdateSet = Server.CreateObject("ADODB.RecordSet")
        UpdateSet.Open "SELECT * FROM tblProjects WHERE tblProjects.Project_id = "&ProjectID&"", DataConnection, 2,

Back to Top
Bunce View Drop Down
Senior Member
Senior Member
Avatar

Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bunce Quote  Post ReplyReply Direct Link To This Post Posted: 17 April 2003 at 4:44pm

1) Only post relevant parts of your code. We're not gonan wade through that to find the problem.

2) Didn't you already post this question before?

Back to Top
simflex View Drop Down
Groupie
Groupie
Avatar

Joined: 10 November 2002
Location: United States
Status: Offline
Points: 63
Post Options Post Options   Thanks (0) Thanks(0)   Quote simflex Quote  Post ReplyReply Direct Link To This Post Posted: 17 April 2003 at 4:56pm

First of all, I sincerely apologize for dumping, I really do.

I pasted a snippet of the code in another forum and they asked for the entire code.

I suspected something similar would happen so I pre-emptively dumped.

Secondly, I don't believe I had posted this entire question before.

I did, however, ask for help with the javascript portion of it awhile and I was fortunate to have gotten someone to help.

With this said, here is a snippet of where I think the problem lies.

    thissql = "SELECT * FROM tblStatus where tblStatus.StatusID = "&txtstatus&""
    set statusset = DataConnection.execute(thissql)
    StatusName = statusset("StatusName")
    statusset.close
    set statusset = nothing
    set UpdateSet = Server.CreateObject("ADODB.RecordSet")
    UpdateSet.Open "SELECT * FROM tblProjectTasks WHERE tblProjectTasks.Project_id = "&ProjectID&" AND tblProjectTasks.TaskID = "¤ttask&"", DataConnection, 2, 2, &H0001

    if not UpdateSet.eof then
        projectTaskID = updateset("ProjectTaskID")
        thecurrentstatus = UpdateSet("StatusID")
        if thecurrentstatus <> txtstatus then
        UpdateSet("StatusID") = txtstatus
        if competestatus = StatusName then
        UpdateSet("DateCompleted") = now()

        end if

        UpdateSet.Update
        UpdateSet.close
        end if

    end if

    if int(txtstatus) = int(compstatusid) then

    nextptaskID = currenttask + 1
    set UpdateSet = Server.CreateObject("ADODB.RecordSet")
    UpdateSet.Open "SELECT * FROM tblProjectTasks WHERE tblProjectTasks.Project_id = "&ProjectID&" AND tblProjectTasks.TaskID = "&nextptaskID&"", DataConnection, 2, 2, &H0001

    if not UpdateSet.eof then
        curentstatus = Updateset("StatusID")
        nexttaskstatusID = curentstatus + 1
        UpdateSet("StatusID") = nexttaskstatusID

       

Back to Top
Bunce View Drop Down
Senior Member
Senior Member
Avatar

Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bunce Quote  Post ReplyReply Direct Link To This Post Posted: 17 April 2003 at 5:14pm

OK. I sort of understand.

You need to remember that you are currently only storing one record for each task. So if one user changes the status for that task, then thats it -> If another user opens that task, it will show that status.

You can't have different status for different users of the same task, as you're only storing it once. As I recall what was suggested to you in another thread was to keep a status of each task for each user, in a new table.

Now that said, if an available option is simply not available to certain users in a drop down list, then it means your code is not populating it for some reason. 

I suggest looking at your code which gets the available statuses from the database and make sure you are getting them all.

Then check your code which is populating the drop down list from this dataset.  I'm assuming you are tyring to 'SELECT' the current task status from this dataset so it is selected in the drop down box.

Cheers,
Andrew

There have been many, many posts made throughout the world...
This was one of them.
Back to Top
simflex View Drop Down
Groupie
Groupie
Avatar

Joined: 10 November 2002
Location: United States
Status: Offline
Points: 63
Post Options Post Options   Thanks (0) Thanks(0)   Quote simflex Quote  Post ReplyReply Direct Link To This Post Posted: 17 April 2003 at 7:06pm

Andrew, thanks again.

But again, this is the first time that I can recall someone had actually made a meaningful stab at this.

The only place I posed this question is at tek tips but they blamed it on my database design.

I knew it was not database but I posed the question anyway to a database forum and one of the experts there looked at the code and said it had to be my asp because my database was designed correctly and my code was fine.

Now, there was a time I wanted to associate tasks to a project based on project type, that must have been what you were referring to.

My client changed her mind about going that route.

 

Sorry I am spending too much time talking about supposed previous posts.

Back to this thread,

You can't have different status for different users of the same task, as you're only storing it once. As I recall what was suggested to you in another thread was to keep a status of each task for each user, in a new table.

I am not trying to store different status for different users of the same task.

If I have dropdown menu, with the statusNames I alluded to earlier,

'Not Started', 'Started', 'In Progress', 'On Hold', 'Completed',

my goal here is that if you are working on a project called Project A with a particular task, let's call the task 'feasibility study', and someone else is working on another project called ProjectB, with a task called 'Feasibility Study' and they are working on these projects concurrently, both developers should have the ability to select a status called 'Not Started' from the status dropdown list.

What is happening right now is that you would select 'Not Started' from the dropdown list and the other developer wanting to select the same option for his/her task can't see the 'Not Started' status value in the dropdown list because it is tied up by the task you just updated it with.

I hope that my explanation is clear.

I am trying to figure it out and I am just having problem picking out the culprit.

 

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 17 April 2003 at 8:15pm
understand that "database design" has nothing to do whether it works or not, but if it is "designed well for the task at hand"

personally.. i don't understand your choice of checkbox for something progressive... makes absolutely no sense to use and very neddlessly complicates the process, which honestly i don't know what it is becaus ei don't have half an hour to wade through all that code...

but i can for sure tell you that if the SQL statement above is what you are using, your database design is very inefficient

sorry couldn't help more, but i wanted to kinda explain the generic term "database design"
Contribute to the working anarchy we fondly call the Internet
Back to Top
Bunce View Drop Down
Senior Member
Senior Member
Avatar

Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bunce Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2003 at 1:27am

"What is happening right now is that you would select 'Not Started' from the dropdown list and the other developer wanting to select the same option for his/her task can't see the 'Not Started' status value in the dropdown list because it is tied up by the task you just updated it with"

What do you mean by tied up? The only reason it wouldnt be displayed on a website is if your code told it not to.  The page will only display what you tell it to display.

I'll post what I did in the last thread:

"I suggest looking at your code which gets the available statuses from the database and make sure you are getting them all.

Then check your code which is populating the drop down list from this dataset.  I'm assuming you are tyring to 'SELECT' the current task status from this dataset so it is selected in the drop down box."

Do this, and you're on the way to working out why an option idn't being displayed in a drop dwn list.

Cheers,
Andrew

There have been many, many posts made throughout the world...
This was one of them.
Back to Top
simflex View Drop Down
Groupie
Groupie
Avatar

Joined: 10 November 2002
Location: United States
Status: Offline
Points: 63
Post Options Post Options   Thanks (0) Thanks(0)   Quote simflex Quote  Post ReplyReply Direct Link To This Post Posted: 18 April 2003 at 5:36am

thanks Bunce for your patience.

Patience, vanity are virtures.

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.