Solved

Conditional region help

Posted on 2006-07-21
13
313 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
Comment Utility
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
Comment Utility
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
Comment Utility
try If Reclistall("employer_id") <> "" & then ....

-dirar
0
 
LVL 6

Expert Comment

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

Author Comment

by:thatelvis
Comment Utility
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
Comment Utility
& is used for concatinating strings together, not in an if statement.  spell out 'and'.
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 1

Author Comment

by:thatelvis
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 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

8 Experts available now in Live!

Get 1:1 Help Now