This topic contains 3 replies, has 0 voices, and was last updated by shambhavi 9 years, 4 months ago.
-
AuthorPosts
-
July 17, 2015 at 12:47 pm #5522
shambhaviI am having issues making this SQL work, looks right to me…any help is appreciated.
CASE {custcol_item_category} WHEN ‘Other’ THEN {fxamount} WHEN ‘Maintenance – Renewal’ AND ({revrecenddate} – {revrecstartdate} = 0) THEN ‘0’ ELSE (({fxamount}/({revrecenddate} – {revrecstartdate})) * 365) WHEN ‘License – Term’ THEN {fxamount} WHEN ‘Maintenance – New’ AND ({revrecenddate} – {revrecstartdate} = 0) THEN ‘0’ ELSE (({fxamount}/({revrecenddate} – {revrecstartdate})) * 365) WHEN ‘License – Perpetual’ AND {revrectemplate.name} != ‘License Immediate’ THEN ‘0’ ElSE WHEN ({revrecenddate} – {revrecstartdate} = 0) THEN ‘0’ ELSE (({fxamount}/({revrecenddate} – {revrecstartdate})) * 365) CASE WHEN {revrectemplate.name} = ‘License Immediate’ THEN {vsoeallocation} END
This is a cached copy. Click here to see the original post. -
July 20, 2015 at 12:49 pm #5523
RaysterJoI am not totally clear on the entire statement, but here is a possible solution. Netsuite requires a CASE for each when and a termination of each CASE.
CASE WHEN {custcol_item_category} IN (‘License – Perpetual’)
THEN CASE WHEN {revrectemplate.name} = ‘License Immediate’
THEN {vsoeallocation}
ELSE CASE WHEN {revrecenddate} = {revrecstartdate}
THEN 0
ELSE (({fxamount}/({revrecenddate} – {revrecstartdate})) * 365)
END
END
ELSE CASE WHEN {custcol_item_category} IN (‘Other’, ‘License – Term’)
THEN {fxamount}
ELSE CASE WHEN {revrecenddate} = {revrecstartdate}
THEN 0
ELSE CASE WHEN {custcol_item_category} IN (‘Maintenance – Renewal’)
THEN (({fxamount}/({revrecenddate}-{revrecstartdate})) * 365)
ELSE CASE WHEN {custcol_item_category} IN (‘Maintenance – New’)
THEN (({fxamount}/({revrecenddate} – {revrecstartdate})) * 365)
ELSE 0
END
END
END
END
END
-
July 20, 2015 at 1:09 pm #5524
MondrayCASE WHEN {custcol_item_category} in (‘Other’ , ‘License – Term’ ) then {fxamount}
WHEN {custcol_item_category} in (‘Maintenance – Renewal’ , ‘Maintenance – New’ ) AND ({revrecenddate} – {revrecstartdate} = 0) then ‘0’
WHEN {custcol_item_category} = ‘License – Perpetual’ AND {revrectemplate.name} ‘License Immediate’ then ‘0’
WHEN {revrectemplate.name} = ‘License Immediate’ then {vsoeallocation}
WHEN ({revrecenddate} – {revrecstartdate} = 0) then ‘0’
ELSE (({fxamount}/({revrecenddate} – {revrecstartdate})) * 365)
END
This is how I would interpret the initial sql.
-
July 22, 2015 at 9:36 am #5525
shambhaviThanks guys…this is a life saver!!
-
AuthorPosts
You must be logged in to reply to this topic.