This topic is locked
[SOLVED]

 Show list by date and group on ASP

9/20/2013 12:36:01 PM
ASPRunnerPro General questions
G
gonzalosb author

Hi All.

ASPR 7.2

MS Database

in my porject i have a list of names and each person is assign to an espesific workgroup
Table NAMES
ID , Name , Group

1 , Adam , 1

2 , Maria , 6

3 , Louis , 1

4 , Jimmy , 20

5 , Poul , 21

6 , Mary , 21
and
Table DATES
ID , Date , Name , Group

  1. how can i do a check list that save the name and date the person miss a meeting?
  2. what i need to do on the view list to show the names by group for those how do not assist on the meeting ? on event Before Display?
    Date 09/20/2013
    group 1

    Adam

    Louis
    Group 6

    Maria
    Group 20

    Jimmy
    Group 21

    Poul

    Mary
    Thanks for your help or any idea you can submit.

G
gonzalosb author 9/25/2013

ok.

i found out that i need 3 tables
Table NAMES

ID , Name , Group

1 , Adam , 1

2 , Maria , 6

3 , Louis , 1

4 , Jimmy , 20

5 , Poul , 21

6 , Mary , 21
Table DATES

ID , Date , Name
Table DATA

ID , Date , Name
with a master relation with DATA and DATES
this goes into DATES , " ADD PAGE " - before record added

dim arr, i, strInsert
if values("Name")<>"" then
arr = Split(values("Name"),",")
' This is the name of the multi check box or
' list select field, its value becomes arr
for i=lbound(arr) to ubound(arr)
strInsert = "insert into Data (name) values ('" & arr(i) & "')"
' add more fields from the add page to be inserted into database
dbConnection.Execute strInsert
next
end if


  1. what can i do to this code to save the name and date and no only the name?
  2. what i need to do on the view list on DATES to show the names by group for those how do not assist on the meeting ? on event Before Display?
    Date 09/20/2013
    group 1

    Adam

    Louis
    Group 6

    Maria
    Group 20

    Jimmy
    Group 21

    Poul

    Mary
    Thanks for your help or any idea you can submit.

admin 9/26/2013

Sorry, it's really hard to understand what your question is about.
If you are talking about inserting both name and date into Data table here is how your sample SQL query might look:

insert into Data (name, date) values ('some name', '2013-09-26')


Hope it makes some sense.

G
gonzalosb author 9/27/2013

thanks Sergey for your respond and sorry that is hard to understans.

the code im using is from

http://xlinesoft.com/asprunnerpro/docs/select_multiple_values.htm
this code helps when you have a multiple values from check boxes or a list field and have them appear as individual database entries.

if i use the sample you say i need to modify the first section too rigth?
if values("Name")<>"" then

arr = Split(values("Name"),",")

for i=lbound(arr) to ubound(arr)
so next to names should be dates values in the first and second line like
values ("name" & "Dates") or

values ("name", "Dates") or

values ("name") & ("Dates") or

values ("name") & values ("Dates")
i can't found the right combination. i hope i explain better this time

thanks for your help.

admin 9/27/2013

Do you a screenshot that can explain how Names and Dates field look on the Edit page?

G
gonzalosb author 9/27/2013


Image 1. table NAMES have the names and the group number assign to each person


Image 2. table DATES used to create records


Image 3. shows DATE add new with " lookup wizard " from NAMES and date on top


Image 4. shows record added on table DATES, names and date


Image 5. show table TABLE1, info from " checkbox " on DATE " add new " was transfer.
As you can see on image 5 only names was updated, what I need is to transfer all the info for each record created
From table NAMES the name and group number
From table DATES the date each record was created.
Maybe the code or the way of transfer the data I'm trying to use is not the right one for this project.
You have any other idea?
thank you for your help

admin 9/27/2013

If I understand your question right and you need to assign the same date value to all records you create use the following SQL query:

strInsert = "insert into Data (name, date) values ('" & arr(i) & "','" & values("Date") & "')"
G
gonzalosb author 10/1/2013



If I understand your question right and you need to assign the same date value to all records you create use the following SQL query:



strInsert = "insert into Data (name, date) values ('" & arr(i) & "','" & values("Date") & "')"



Useing this code and i have an error, " date_add.asp?ferror=1& "
I should keep the rest of the codeing as it is or need to modify on any other section in orther to work.

I try every combination that I can think off.



dim arr, i, strInsert

if values("Name")<>"" then

arr = Split(values("Name"),",")



for i=lbound(arr) to ubound(arr)

strInsert = "insert into Table1 (name, date) values ('" & arr(i) & "','" & values("Date") & "')"



dbConnection.Execute strInsert

next

end if


thank you.

admin 10/2/2013

In your code you refer to "Table1". I don't think this is a correct table name. Make sure that all field and table names in your code are correct.
If you need more help post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

G
gonzalosb author 10/5/2013

that's it !!!! got it !!!!
the code is correct.



dim arr, i, strInsert

if values("Name")<>"" then

arr = Split(values("Name"),",")



for i=lbound(arr) to ubound(arr)

strInsert = "insert into Table1 (name, date) values ('" & arr(i) & "','" & values("Date") & "')"



dbConnection.Execute strInsert

next

end if


But needs to be paste on " AFTER RECORD ADDED " because de date needs to be save in to " DATE " table before the record can be transfer to " TABLE1 "
thanks Sergey for your help.
I have more question but I will open other forum so don't get confuse..
PS: I found that if you have more than one checkbox list (Names1 and Names2) and you wan to use this function only need to add the same code again before the last END IF changing the values in bold ....hope it helps and make sense.



dim arr, i, strInsert

if values("**Names1**")<>"" then

arr = Split(values("**Names1**"),",")



for i=lbound(arr) to ubound(arr)

strInsert = "insert into Table1 (name, date) values ('" & arr(i) & "','" & values("Date") & "')"



dbConnection.Execute strInsert

next
dim arr, i, strInsert

if values("**Names2**")<>"" then

arr = Split(values("**Names2**"),",")



for i=lbound(arr) to ubound(arr)

strInsert = "insert into Table1 (name, date) values ('" & arr(i) & "','" & values("Date") & "')"



dbConnection.Execute strInsert

next
end if
end if