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

SSIS Syntax

I am trying to write the expression for the following.

([Est Delivery Date]) == 0 || ([Est Delivery Date]) == 0 && ([In DC Based On Allc#]) == 0 ? 123104 : ([In DC Based On Allc#])

I actually need this to happen in my expression(VB Version)
IF EstDeliveryDate <> 0 and  ([In DC Based On Allc#]) = 0 THEN
  EstDeliveryDate
ELSEIF EstDeliveryDate = 0 THEN
  '1234'
ELSE
  ([In DC Based On Allc#])
END IF
0
johnnyaction
Asked:
johnnyaction
  • 10
  • 10
1 Solution
 
vdr1620Commented:
Try the below exp
0
 
vdr1620Commented:
Try the below exp
[EstDeliveryDate] != 0 && [In DC Based On Allc#] = 0 ? [EstDeliveryDate] : [EstDeliveryDate] = 0 ? '1234' : [In DC Based On Allc#]

Open in new window

0
 
johnnyactionAuthor Commented:
It did not work. There must be a syntax issue?

[EstDeliveryDate] != 0 && [In DC Based On Allc#] = 0 ? [EstDeliveryDate] : [EstDeliveryDate] = 0 ? '1234' : [In DC Based On Allc#]

Im not real familiar with the code just yet. Is the elseif portion in this code the same as the code I gave?
0
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
vdr1620Commented:
i should have tested it before posting it..my Bad..try the below SQL

The expression was missing = operator, and single quotes instead of double and there was a conflict of data types around the operator

(DT_STR,20,1252)[EstDeliveryDate] != "0" && (DT_STR,20,1252)[In DC Based On Allc#] == "0" ? (DT_STR,20,1252)[EstDeliveryDate] : (DT_STR,20,1252)[EstDeliveryDate] == "0" ? "1234" : (DT_STR,20,1252)[In DC Based On Allc#]
0
 
johnnyactionAuthor Commented:
Well I made a mistake too. I just put in any value for "1234" It really needs to be a double precision float[DT_R8]. This is what I should have wrote in my first post

IF EstDeliveryDate <> 0 and  ([In DC Based On Allc#]) = 0 THEN
  EstDeliveryDate
ELSEIF EstDeliveryDate = 0 THEN
  123104
ELSE
  ([In DC Based On Allc#])
END IF

Sorry for the confusion
0
 
vdr1620Commented:
In such a Case try the below Exp without any conversions

EstDeliveryDate != 0 && [In DC Based On Allc#] == 0 ? EstDeliveryDate :EstDeliveryDate == 0 ? 123104 : [In DC Based On Allc#]
0
 
johnnyactionAuthor Commented:
Unable to parse statment??
0
 
vdr1620Commented:
It works fine for me...
Make sure all the datatypes are the same... That's the reason i Converted all of them to string in previous post's --- ID: 33646877
0
 
johnnyactionAuthor Commented:
Check it out
EE.docx
0
 
vdr1620Commented:
can you tell me the datatypes of the columns being used in the Exp.. It might just be the that the datatypes differ
0
 
johnnyactionAuthor Commented:
1 column using precision-float [DT_R8]. That is what it was from the beginning
0
 
vdr1620Commented:
In such a case you will need to convert the other column to Float or this column to match the data type of other column  or both to match datatypes Such as the exp below...

(DT_R8)EstDeliveryDate != 0 && (DT_R8)[In DC Based On Allc#] ==0 ?(DT_R8)EstDeliveryDate :(DT_R8)EstDeliveryDate == 0 ? 1234 : (DT_R8)[In DC Based On Allc#]


Just remove (DT_R8) beside the float column
Derived.jpg
0
 
johnnyactionAuthor Commented:
I am still red(error). I think it may be some sort of syntax error still. Have you tried moving off that line your on to see if it turns red? Just trying all avenues???
0
 
vdr1620Commented:
It works fine for me..
Did you try changing all the Column Datatypes to string.. I am sure that its because of data type mismatch..
You will need to post your sample data for those two columns or capture the Error msg ..just hover over the  error expression and post the screen shot ..so that i can see the error msg to help you out
Derived.jpg
0
 
johnnyactionAuthor Commented:
This is what I had originally
([Est Delivery Date]) == 0 || ([Est Delivery Date]) == 0 && ([In DC Based On Allc#]) == 0 ? 123104 : ([In DC Based On Allc#])    With the precision_float.

The datatype never needed to be changed and thats what it needs to be. I just needed the logic to change a little in my original post
0
 
johnnyactionAuthor Commented:
here ya go...
EE1.docx
0
 
vdr1620Commented:
I posted the logic according to the SQL you posted and i have tested it..which works fine.. The OLD expression you posted above also works fine for me without any syntax errors.. Unless and until you post the exact error msg .. i will not be able to help you further
0
 
vdr1620Commented:
My bad..dint see your post..ignore my previous post.. What is your column Name

Please check your column Name..I see that you have missed Square brackets for Column --- Est Delivery Date..Add square brackets in case the Column Name have spaces ..

. Try the expression below

[Est Delivery Date] != 0 && [In DC Based On Allc#] == 0 ? [Est Delivery Date] :[Est Delivery Date] == 0 ? 123104 : [In DC Based On Allc#]
0
 
johnnyactionAuthor Commented:
Didnt even realize the spelling of the column. That was it. Thanks for your help
0
 
johnnyactionAuthor Commented:
Nice work
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

  • 10
  • 10
Tackle projects and never again get stuck behind a technical roadblock.
Join Now