Community

Extrakt / export row number of table

Hi,

I got a multipage table and I like to export the row number of each row into a field with the ODBC-Export.

How is it done?

regards Alex

0

Comments

6 comments

  • Avatar
    Rahul Kapoor

    Add an additional column in your table named "RowNumber". Then you can use below VB script in a script rule to get the required row number in it:

    imports microsoft.visualbasic
    dim intx as integer
    for intx=0 to context.Field("RowNumber").Items.Count-1
    context.Field("RowNumber").Items(intx).text=str(intx+1)
    next
    context.CheckSucceeded=true

    Hope this resolves your query!

    Regards,
    Rahul Kapoor
    www.linkedin.com/in/rahulkapoor309/

    0
  • Avatar
    A.Lindig

    Thx for the reply.

    I made a new column in the document definition. But I didnt find the right spot to put the script. Where exact do I have to place the script?

    Regards,

    Alex

    0
  • Avatar
    Rahul Kapoor

    In Project setup station, open the properties of your table. Then go to the Rules tab and create a new script rule. Make sure you add the "RowNumber" column in the list of available fields and uncheck the Read-only flag for it. The click on Edit button to add the script. Make sure the programming language selected is 'Visual Basic .NET' in the script editor window.

    0
  • Avatar
    A.Lindig

    Hi, I did everything as you said. And the script is working in the script editor.

    But when I apply the document definition then I get an error "the object reference was not found"

    Any idea why I get an error and how to solve it?

    Thank you.

    Regards,

    Alex

    0
  • Avatar
    Rahul Kapoor

    The new rule must be created at the top of the document definition hierarchy. That was your only issue.

    Delete the rule from the RowNumber that we created earlier.

    Bring up Document Definition, Document Definition Properties. Switch to Rules. Click New Rule. Add the field RowNumber to the fields and set it to not be read only and add the script to it.

    0
  • Avatar
    A.Lindig

    Hi,

    Thank you very much that did it.

    Now it does exactly what I need. Perfect!

    Again Thank you for your help.

    Regards,

    Alex

    0

Please sign in to leave a comment.