Solved

Conditional region help

Posted on 2006-07-21
13
314 Views
Last Modified: 2006-11-18


hello,

I am trying to get this conditional region to work, the & is giving me problems, how can I have it correct.

thanks for any help

<%
' Show IF Conditional region3
  If (Reclistall.Fields.Item("employer_id").Value) <> "" &
(Reclistall.Fields.Item("employer_id").Value = Session("et_login_id")) Then
%>
0
Comment
Question by:thatelvis
  • 6
  • 3
  • 3
  • +1
13 Comments
 
LVL 13

Expert Comment

by:jrram
ID: 17154376
Are you getting an error? or what are you expecting to see?
Are you sure all of your variables are populated?
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17154394
Microsoft VBScript compilation error '800a03ea'

Syntax error

/cp_update_profiles_added.asp, line 507

If (Reclistall.Fields.Item("employer_id").Value) <> "" &
--------------------------------------------------------^
0
 
LVL 6

Expert Comment

by:dxz2
ID: 17154518
try If Reclistall("employer_id") <> "" & then ....

-dirar
0
 
LVL 6

Expert Comment

by:dxz2
ID: 17154526
the whole if:
If Reclistall("employer_id") <> "" & Reclistall("employer_id") = Session("et_login_id") Then
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17154666
Hi yea,
I see where I have been going wrong thank you very much for your help.

I am using
If Reclistall("employer_id") <> ""

where as the value of ""  is null.

how can I have it so if it is not null & Reclistall("employer_id") = Session("et_login_id") Then


regards

Kenny
0
 
LVL 22

Expert Comment

by:WMIF
ID: 17155536
& is used for concatinating strings together, not in an if statement.  spell out 'and'.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 1

Author Comment

by:thatelvis
ID: 17156202
I did give that a go but the employee_id is null

<%
' Show IF Conditional region3
If Reclistall("employer_id") <> "" AND Reclistall("employer_id") = Session("et_login_id") Then
%>

instead of <> "" how can I have it so it says if it is not null as that record in my data base is null.

regarsd

kenny

0
 
LVL 6

Assisted Solution

by:dxz2
dxz2 earned 150 total points
ID: 17156577
WMIF is right, I am sorry I didn't notice that.
try:

If not isNull(Reclistall("employer_id")) AND Reclistall("employer_id") = Session("et_login_id") Then
 'do something
end if

-dirar
0
 
LVL 22

Expert Comment

by:WMIF
ID: 17156929
you will need to break up the if statements though when working with null values.  in the statement above, it compares the null value with both conditions and you will get an error with the second condition.


If not isNull(Reclistall("employer_id")) then
  if Reclistall("employer_id") = Session("et_login_id") Then
    'do something
  end if
end if
0
 
LVL 22

Accepted Solution

by:
WMIF earned 250 total points
ID: 17156946
or i think this *might* work to combine the conditions:

If (Reclistall("employer_id") & "") <> "" AND Reclistall("employer_id") = Session("et_login_id") Then
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17159266
Hi you all thanks for your help,
I am realy pulling my hair out with this. i have tried all waht you have given but it does not seem to work, this leads me to thinking maybe my approach is incorrect. I have this recordset below. as you see 3 tables are joined, I have a repeat region and the likes of name etc all shows, but it is the table that is joined with cs_employ_usr.employer_id, when I check the record set that appears null which is correct. on my page i have a button, so if the cs_employ_usr.employer_id is null then a button will show allowing the user to click it thus entering some database for the cs_employ_usr.employer_id, i wanted to have a show hide , thus if it has been clicked by the user then a different button is showing. I cannot get the show hid to work. am I doing it the correct way, I cannot see why joing 3 tables should be a problem , even if one of the tables has no data I would have expected it to show as null.

I have tried using

If not isNull(Reclistall("employer_id")) then
  if Reclistall("employer_id") = Session("et_login_id") Then
    my button in here
  end if
end if

what I find is that the button will appear if the  cs_employ_usr.employer_id has a value or not. the recordset is below.



SELECT cs_employ_usr.id_usr AS id_usr_1, cs_profile_one.firstname_usr, cs_profile_one.lastname_usr, cs_profile_one.gender_usr,  cs_might_use.id_usr, cs_might_use.id_usr_pro, cs_might_use.countryprofessional, cs_might_use.date_usr, cs_might_use.might_use_pk, cs_employ_usr.employer_id, cs_employ_usr.employ_tbl_pk
FROM ((cs_might_use
LEFT JOIN cs_profile_one ON cs_profile_one.id_usr=cs_might_use.id_usr_pro)
LEFT JOIN cs_employ_usr ON cs_employ_usr.employer_id=cs_might_use.id_usr)
WHERE cs_might_use.id_usr="+Session("kt_login_id")+"


thanks for any help

kenny
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17159385
If the table rec cs_employ_usr.employer_id has no value, as in it is null then I would expect this should work on my page, but it doesnt I want to show a button if the recordset is empty. but i am counfused as it is not all the recordset is empty it is only one of the tables that is joined.

<% If Reclistall_u_pro_added.EOF And Reclistall_u_pro_added.BOF Then %>
show button


what can I do

huum

kenny
0
 
LVL 1

Author Comment

by:thatelvis
ID: 17159475
Hi again guys,

I got it working but am totally confused as to how. can some one tell me the drfference between these two

                    <%
' Show IF Conditional region3
  If (Reclistall_u_pro_added.Fields.Item("employer_id").Value) = "" Then


the one below works for me but I cannt see what is the defference between that one and the one above.
 
  <% If (Reclistall_u_pro_added("employer_id") & "") = ""  Then      %>

regards

kenny
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ODBC connection string for ODBC 6.01 24 72
UT-F and other ASP code. What is it for ? 3 31
pass url parameter as session 9 48
Auto Submit on dropdown box 14 53
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now