How to Convert System.Int32[]

  • Hi

    I have posted alot of different question on the forum within 3 days. I am new in SSRS.. Ooooohhhh. Its really tricky to handle it.

    Anyways... The problem is as following...

    This code belongs from Accounts.cs.

    public int[] GenerateAccounts(int ToatlAccounts, int HighestAccount)

    {

    int[] AccountList = new int[HighestAccount];

    int LoopVar = 0;

    for (int i = ToatlAccounts; i <= HighestAccount; i++)

    {

    Convert.ToInt32( AccountList[LoopVar] = i );

    LoopVar++;

    }

    return AccountList;

    }

    But in SSRS, I have the following code:

    =Code.m_Accounts.GenerateAccounts(Parameters!totalAccounts.Value.ToString(), Parameters!maxAccount.Value.ToString())

    But in the Preview tab, it just shows me System.Int32[].

    I wonder how to convert this object into real numbers...

    Thanx in advace.

    bye and peace

  • There are some really weird things going on here.

    But

    Convert.ToInt32( AccountList[LoopVar] = i );

    is dead wrong. You probably mean

    AccountList[LoopVar] = i;

    Why the Convert ?

    You are only filling up the array from ToatlAccounts to the max. Index 0..ToatlAccounts will be empty. Thus the debugger is displaying the type (int32) only because there is no value.

  • Hi.

    Dat was just typing mistake:(

    I have to be careful next time...

    thnx

  • I changed the code as following: But still have System.int32

    public int[] GenerateAccounts(int ToatlAccounts, int HighestAccount)

    {

    int[] AccountList = new int[100];

    for (int i = 1; i < 100; i++)

    {

    AccountList = i ;

    }

    return AccountList;

    }

  • I found the solution for this problem.

    Its not possible to loop throught the integer array object in expression window. I added one extra function in custom code and call custom code function rather class. But in custom code you can call class function.

    best of luck 🙂

Viewing 5 posts - 1 through 4 (of 4 total)

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