InvestmentType == "Forward Cash"

  • hi

    i have a tbale and after the table i want to put in a derived column that then pick just the data from the InvestmentType == "Forward Cash"

    now i have tried the above code but doesn't work whats the best way to do this

  • ronan.healy (8/11/2014)


    hi

    i have a tbale and after the table i want to put in a derived column that then pick just the data from the InvestmentType == "Forward Cash"

    now i have tried the above code but doesn't work whats the best way to do this

    Your question is not very clear, but if you are talking about picking only certain data in a dataflow, just use a SELECT/WHERE query as your data source, rather than 'table or view'.

    The absence of evidence is not evidence of absence
    - Martin Rees
    The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
    - Phil Parkin

  • Phil Parkin (8/11/2014)


    ronan.healy (8/11/2014)


    hi

    i have a tbale and after the table i want to put in a derived column that then pick just the data from the InvestmentType == "Forward Cash"

    now i have tried the above code but doesn't work whats the best way to do this

    Your question is not very clear, but if you are talking about picking only certain data in a dataflow, just use a SELECT/WHERE query as your data source, rather than 'table or view'.

    +1

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • ronan.healy (8/11/2014)


    hi

    i have a tbale and after the table i want to put in a derived column that then pick just the data from the InvestmentType == "Forward Cash"

    now i have tried the above code but doesn't work whats the best way to do this

    Do you only want to change the value of the rows containing InvestmentType == "Forward Cash"?

    Or do you want values of that type to process in one direction while values of another type process in a different direction?

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • the info is coming from a table.

    can you write scripts in a data flow i have never done it before.

    the info is in a table but i need to do all the following

    For all records where Investment Type = ‘Forward Cash’

    I.The records will need to be grouped by the TaxLotID field – consider the logic below prior to grouping the records

    II.Identify currency purchased/sold codes

    a.Parse out the first 3 characters of the field Tax Lot Description – this is the currency purchased code. [store this as temp variable for populating later]

    b.Parse out the 3 characters starting from position 9 from the Tax Lot Description – this is the currency Sold code. [store this as temp variable for populating later]

    III.Identify the amounts purchased / amounts sold

    a.If the Quantity figure < 0, this is the Currency Purchased Amount

    b.If the Quantity figure > 0, this is the Currency Sold Amount

    would it be better to do a script or do it in derived columns as once i do all this i need to map it to another table that stores my output

  • All of that can be done via TSQL query in your data source.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • ok

    would I still be able to use SUBSTRING(TaxLotDescription,1,3) for pulling the first 3 chars.

    how would I be able to do in tsql

    III.Identify the amounts purchased / amounts sold

    a.If the Quantity figure < 0, this is the Currency Purchased Amount

    b.If the Quantity figure > 0, this is the Currency Sold Amount

    I need to basically create a new column and put the figures in under the right headings

  • ronan.healy (8/11/2014)


    ok

    would I still be able to use SUBSTRING(TaxLotDescription,1,3) for pulling the first 3 chars.

    how would I be able to do in tsql

    III.Identify the amounts purchased / amounts sold

    a.If the Quantity figure < 0, this is the Currency Purchased Amount

    b.If the Quantity figure > 0, this is the Currency Sold Amount

    I need to basically create a new column and put the figures in under the right headings

    Yes on the use of substring.

    For the new columns - you can use pivot, case statements, or even subqueries.

    Are you pulling this data to create a report?

    Or are you trying to move this data from one table to a different table?

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • im going to be moving the data from 1 table to another

  • so say I use something like this

    SELECT *

    FROM dbo.BNYForwardsTaxLotsForwards

    WHERE Quantity IN (SELECT Quantity as CurrencyPurchasedAmount

    FROM dbo.BNYForwardsTaxLotsForwards

    WHERE investmentType ='Forward Cash'

    and Quantity < 0)

    when I want to map CurrencyPurchasedAmount to a field in my table how can i

  • ronan.healy (8/11/2014)


    so say I use something like this

    SELECT *

    FROM dbo.BNYForwardsTaxLotsForwards

    WHERE Quantity IN (SELECT Quantity as CurrencyPurchasedAmount

    FROM dbo.BNYForwardsTaxLotsForwards

    WHERE investmentType ='Forward Cash'

    and Quantity < 0)

    when I want to map CurrencyPurchasedAmount to a field in my table how can i

    Since you are using a select *, your field name for the source would be Quantity.

    What is the field name for the destination? That is your mapping.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • CurrencyCodePurchased is the name of the column it will be mapped to

  • will have to declare a variable for it to work

  • ronan.healy (8/12/2014)


    will have to declare a variable for it to work

    No, you just map the datasource column to the CurrencyCodePurchased column in your destination object.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • how if im using an sql script

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic. Login to reply