joi, 30 iunie 2016

Get customer's party type

Starting from a LedgerJournalTrans line:

if (ledgerJournalTrans.AccountType == LedgerJournalACType::Cust)
        {
            if (CustTable::find(DimensionStorage::ledgerDimension2AccountNum(
ledgerJournalTrans.LedgerDimension)).partyType() == DirPartyType::Person)
              {
               ........
               }
        }

So, the partyType() method from CustTable will do the job.

Now here is how i did it in Sql:

--DirPerson 2975, DirOrganization 2978, CompanyInfo 41, OMOperatingUnit 2377, OMTeam 5329
SELECT CASE (SELECT dpt.INSTANCERELATIONTYPE
        FROM DIRPARTYTABLE AS dpt
        WHERE dpt.RECID = ct.PARTY)
            WHEN 2975 THEN 'Person'
            WHEN 2978 THEN 'Organization'
        END AS 'Party'
    , ct.AccountNum
FROM CUSTTABLE AS ct

and in order to get only the persons, just add a cte over it:


WITH parties
AS
(
    SELECT CASE (SELECT dpt.INSTANCERELATIONTYPE
            FROM DIRPARTYTABLE AS dpt
            WHERE dpt.RECID = ct.PARTY)
                WHEN 2975 THEN 'Person'
                WHEN 2978 THEN 'Organization'
            END AS 'Party'
        , ct.AccountNum
    FROM CUSTTABLE AS ct
)
SELECT *
FROM parties p
WHERE p.Party = 'Person'

joi, 2 iunie 2016

SSRS - Hide tablix column when all rows are empty

First of all, don't use Hidden property but right click on tablix header, choose Column Visibility




and below "Show or hide based on an expression" write down your expression.

As an example:

 =IIF(Max(Fields!OffsetDimension.Value, "LedgerTransStatementDS")= "", true, false)

So, if maximum of all field values is equal to an empty string, it means we have absolutely no values in this column.

If you would add this expression to the Hidden property then you will end up with a gap in your table.