How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Russell H. Your Own Question

Russell H.
Russell H., Programmer & Coder
Category: Programming
Satisfied Customers: 9528
Experience:  Programmer & Coder
13568747
Type Your Programming Question Here...
Russell H. is online now
A new question is answered every 9 seconds

Thank you my question. I have one. I want to use this syntax

Customer Question

Thank you for answering my question. I have one more follow up. I want to use this syntax and add an if statement so that if sourceidx=8 then do not display, otherwise display... Right(ref1,len(ref1)-(pos(ref1," ")))
Submitted: 1 year ago.
Category: Programming
Customer: replied 1 year ago.
Thank you for answering my question. I have one more follow up. I want to use this syntax and add an if statement so that if sourceidx=8 then do not display, otherwise display...Right(ref1,len(ref1)-(pos(ref1,"^")))
Expert:  Russell H. replied 1 year ago.
Hi, thank you for contacting JustAnswer.com. My name is Russell. I will do my best to provide the right answer to your question.
Pure SQL does not have an IF statement. If you are dealing with SQL through any front-end programming language, such as VB or Java, etc., you can easily put in an IF, quite literally.
But with not-pure SQL, the next question is: *what* SQL? there are so many of them. TransactSQL (which has an IF)? SQL Server? MySQL? MS SQL ? something else? please let me know.
SQL Server's IF statements look like this:
============================================
DECLARE @your_value INT;
SET @your_value = 11;
IF @your_value < 20
PRINT 'JustAnswer.com';
ELSE
PRINT 'BetterCodeNeeded.com';
GO
============================================
Customer: replied 1 year ago.
I am using sybase infomaker connected to SQL DB. I can do a compute IF expression.
Expert:  Russell H. replied 1 year ago.
More or less like this:
CASE ( sourceidx8 THEN RIGHT(ref1,len(ref1)-(pos(ref1," "))) )
perhaps. I finessed because I'm not sure what the ^= or 'not equal to' symbol is in Sybase Infomaker, but presumed that 'OR' is usable. That might possibly be wrong, but the rest is indubitable I think.
Let me know - or if this answers your question completely, please rate my Answer. Thanks.
Customer: replied 1 year ago.
I tried the expression and get "invalid argument to function"
Customer: replied 1 year ago.
Since I can't get CASE to work... I tried this...The original computed field is compute_4 so I tried an if statementIf( sourceidx = '8', compute_4, 0 )But I get expression types must match...
Expert:  Russell H. replied 1 year ago.
I'm sorry - some characters got lost. You'll have to take the code from a posted file, where the operator characters won't be filtered out. Here's the file with that one expression in it:
http://www.filedropper.com/sybasestat1
As for the new effort you just posted: it just doesn't look right to me.
Customer: replied 1 year ago.
I get "invalid argument to function"
Customer: replied 1 year ago.
see attached doc with error.
Expert:  Russell H. replied 1 year ago.
OK, thanks for posting that. I am trying to prepare several more suggested statements that will perhaps (one of them at least) work and indicate the path toward the solution you need. I will post that file, by this evening (or sooner perhaps.)
Customer: replied 1 year ago.
Do you have the link for the file you were going to post? i have not received a link to it yet.
Expert:  Russell H. replied 1 year ago.
Apologies! I don't think the delay was my fault though.
Your question suffered a rare breakdown that made it unable to be viewed, brought up, or posted to. I had to get this question online and postable again, so I missed by intended deadline to give you the file posting ID.
Let me continue working on this with you - another posting is imminent. (Unless the system breads down again - 'fingers crossed' as it were.)
Expert:  Russell H. replied 1 year ago.
Here's the file posting:
http://www.filedropper.com/sybasestat2
and I must apologize again for the delay. It was caused by a rare fault in the JustAnswer system. Which hopefully won't happen again.