Link to home
Start Free TrialLog in
Avatar of thatelvis
thatelvis

asked on

Conditional region help



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
%>
Avatar of jrram
jrram
Flag of United States of America image

Are you getting an error? or what are you expecting to see?
Are you sure all of your variables are populated?
Avatar of thatelvis
thatelvis

ASKER

Microsoft VBScript compilation error '800a03ea'

Syntax error

/cp_update_profiles_added.asp, line 507

If (Reclistall.Fields.Item("employer_id").Value) <> "" &
--------------------------------------------------------^
try If Reclistall("employer_id") <> "" & then ....

-dirar
the whole if:
If Reclistall("employer_id") <> "" & Reclistall("employer_id") = Session("et_login_id") Then
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
& is used for concatinating strings together, not in an if statement.  spell out 'and'.
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

SOLUTION
Avatar of Dirar Abu Kteish
Dirar Abu Kteish
Flag of Palestine, State of image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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
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