| Author |
Topic  |
|
|
samflex
Starting Member
USA
4 Posts |
Posted - 08 June 2010 : 09:16:30
|
Dearest Experts,
I am a first timer here and I ask for your patience and heavenly assistance.
I have one serious issue.
The history:
I have 12 attorneys. This number doesn't change.
Each attorney is assigned a case, no more than one case a time.
This is very critical and a bit confusing and I will explain it a bit more.
The cases are assigned randomly.
First, a case is created, then each attorney is selected from the dropdown and assigned a case.
The dropdown is also known as a wheel.
Once a attorney is assigned a case, the attorney disappears from the dropdown (wheel).
Once each attorney has been assigned a case, and no attorney is left on the dropdown, any attempt to assign another case to a attorney results to the following message I created:
"No attorneys available to handle case " & caseid (whatever the case number is)"
This is simply because ALL attorneys on the dropdown has been assigned a case.
These scenarios work great so far.
The problem I have now is that once all attorneys have each been assigned a case, and a new case is created, rather than this code below:
If RS.EOF Then
Response.Write "FATAL ERROR: No attorneys available to handle case " & caseid
RS.Close
Conn.Close
Response.End
End If
we would like to reload the dropdown with SAME attorneys and start assigning new cases to each attorney all over again.
I indicated that each attorney is assigned a case, no more than one case a time in one WHEEL or dropdown.
I also indicated that is a bit confusing.
Here is why. Even though each attorney is assigned one case a time, this is within one wheel or dropdown.
Once all attorneys in this wheel or dropdown have each been assigned a case, the dropdown or wheel is now empty and will need to be reloaded so we can start assigning cases to each attorney all over again.
Next time a case is created, the wheel or dropdown is reloaded with same attorneys and cases are assigned to each attorney as they come.
This process goes on until all attorneys in the dropdown or wheel is assigned a case.
I tried this:
If RS.EOF Then
Response.Write "Reloading attorneys wheel"
SQL = "SELECT j.AttorneyCode, j.AttorneyName " & _
"FROM Attorneys j " & _
"LEFT JOIN Cases c ON c.AttorneyCode = j.AttorneyCode " & _
"WHERE c.AttorneyCode IS NULL " & _
"ORDER BY j.AttorneyName"
RS.Close
Conn.Close
Response.End
End If
But it isn't working. I am really stumped as to how to handle this.
I would really, really appreciate your assistance with handling this portion ofthe problem.
3 tables are involved so far:
Attorney table (lookup table) AttorneyCode nvarchar(50), AttorneyName nvarchar(50)
Clients table (lookup table) ClientID int pk identity key, ClientName nvarchar(50)
Cases table caseId int pk identity key, attorneyCode nvarchar(50), ClientId int, CaseName nvarchar(50), CaseType nvarchar(50
Do I need to make any changes to these tables to help solve this problem?
Please let me know and please, please help
Below is the entire working code.
Many thanks in advance for your assistance.
May you be rewarded ten fold for your assistance. |
|
|
cripto9t
Average Member
  
USA
881 Posts |
Posted - 08 June 2010 : 10:41:38
|
Just a suggestion .
Add another column to your attorney table default 0 and set it to 1 when they have been assigned a case. When all Rows are set to 1, Reset the column to 0.
Sub GetAvailableAttorneys()
Dim SQL
Dim RS
SQL = Select AttorneyCode From Attorney
Where New_Column = 0
Set RS = Conn.Execute( SQL )
if RS.EOF then 'No Attorneys Available, time to start over
SQL = Update Attorney
Set New_Column = 0
Conn.Execute(SQL)
'call this sub again
GetAvailableAttorneys
else
<select name="attorney"><%
Do Until RS.EOF %>
<option value="<%=RS("AttorneyCode")%>"><%=RS("AttorneyCode")%></option>
<% RS.MoveNext
Loop
RS.Close%>
</select>
end if
end Sub
|
_-/Cripto9t\-_ |
 |
|
|
AnonJr
Moderator
    
United States
5768 Posts |
Posted - 08 June 2010 : 11:02:57
|
You may also want to try asking at a programming site like http://stackoverflow.com - this is the support site for a specific project, and while we do try to help, we have a more narrowly targeted audience.  |
 |
|
|
samflex
Starting Member
USA
4 Posts |
Posted - 08 June 2010 : 13:03:59
|
Cripto9t,
Thank you so very much for your kindness.
I integrated the code but not sure if I used it in the right spot because I am getting a dropdown with no values.
Can you please see how I used it?
I am posting latest code and I will only highlight the new code for easier read.
AnnonJr, I will post it there as well.
I posted here since it is an ASP question and this forum based on everything I have browsed so far is very savvy in figuring out ASP-related issues and much more.
Thank you two.
Hopefully, Cripto9t will take me home on this.
|
 |
|
|
cripto9t
Average Member
  
USA
881 Posts |
Posted - 08 June 2010 : 14:34:27
|
I'm no code wiz so don't count on me to much . 2 things -
1. Put the AssignedCases column in the Attorney table not the Cases table. Then every time You assign a new case (If Request("POSTBACK") = "NEWCASE"), Update the column to 1 for that attorney.
2. You're not calling the sub
Replace your code<select name="attorney">
<%
Do Until RS.EOF
%>
<option value="<%=RS("AttorneyCode")%>"><%=RS("AttorneyCode")%></option>
<%
RS.MoveNext
Loop
RS.Close
%>
</select> with this'Call Sub GetAvailableAttorneys to display attorney select box
GetAvailableAttorneys |
_-/Cripto9t\-_ |
 |
|
|
samflex
Starting Member
USA
4 Posts |
Posted - 09 June 2010 : 11:01:09
|
Thanks a lot Cripto9t for your help.
I am not real sure that your approach will work as far as updating the Attorney table.
However, your approach has helped me in another way.
What I have decided to do, using your approach, is to create a Staging table, save Attorney case assignments to that table until all 12 attorneys have been assigned a case each.
Then I dump the cases from staging table to cases table, thereby resetting the attorney dropdown list.
I am not real sure if that is the most efficient way but it seems to hold up.
What I need now is rather than have it reload automatically, I want to put a button there that says, "Reload attorney wheel" so that the user can click that button to reload the dropdownlist.
I am working on that.
Meanwhile, if you have any suggestions please share with me.
That would be greatly appreciated.
meanwhile, I will try the link that AnonJr provided.
Again, many thanks for your smart idea. |
 |
|
|
samflex
Starting Member
USA
4 Posts |
Posted - 09 June 2010 : 15:39:46
|
Sorry guys, even my own solution didn't work.
It works as far as reloading Attorneys' dropdown list but it doesn't capture when an attorney has been assigned a case already.
Soooo back to square one.
AnonJr, since you suggested that stackflow link, do you know how it works?
I spent more than 20 minutes (yes, shameful), trying to figure out how to post a thread.
It kept telling me to "choose a tag".
I have no clue what that is or how to go about it.
This is getting to be way too much fun.
|
 |
|
| |
Topic  |
|
|
|