• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

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
%>
0
thatelvis
Asked:
thatelvis
  • 6
  • 3
  • 3
  • +1
2 Solutions
 
jrramCommented:
Are you getting an error? or what are you expecting to see?
Are you sure all of your variables are populated?
0
 
thatelvisAuthor Commented:
Microsoft VBScript compilation error '800a03ea'

Syntax error

/cp_update_profiles_added.asp, line 507

If (Reclistall.Fields.Item("employer_id").Value) <> "" &
--------------------------------------------------------^
0
 
Dirar Abu KteishCommented:
try If Reclistall("employer_id") <> "" & then ....

-dirar
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Dirar Abu KteishCommented:
the whole if:
If Reclistall("employer_id") <> "" & Reclistall("employer_id") = Session("et_login_id") Then
0
 
thatelvisAuthor Commented:
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
 
WMIFCommented:
& is used for concatinating strings together, not in an if statement.  spell out 'and'.
0
 
thatelvisAuthor Commented:
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
 
Dirar Abu KteishCommented:
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
 
WMIFCommented:
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
 
WMIFCommented:
or i think this *might* work to combine the conditions:

If (Reclistall("employer_id") & "") <> "" AND Reclistall("employer_id") = Session("et_login_id") Then
0
 
thatelvisAuthor Commented:
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
 
thatelvisAuthor Commented:
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
 
thatelvisAuthor Commented:
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 3
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now