?
Solved

Conditional region help

Posted on 2006-07-21
13
Medium Priority
?
322 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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:Dirar Abu Kteish
ID: 17154518
try If Reclistall("employer_id") <> "" & then ....

-dirar
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:Dirar Abu Kteish
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
 
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:Dirar Abu Kteish
Dirar Abu Kteish earned 600 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 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

764 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