Display Method

This question is answered

Hello all,

I have a Display method that I wrote so my SalesCustItemStatistics Report would display the IventoryLocation field. That report uses datas from the CustTable amongs others and the field I'm calling from that Display Method comes from the CustTable. Here is the method:

Display InventLocationId Depot()
SELECT InventLocation FROM CustTable;
Return CustTable.InventLocation;

It seems good, there is no error message yet when I run the report, my field is completly empty except for the Label saying "Depot" (I chose that as a label, it means warehouse in french). I don't understand what is going on, I even tried without the Method, simply choosing the table CustTable and the Field InventLocation, it was just supposed to call the datat from there since there is a datasource of CustTable in that report but yet again it was completly empty.

Can someone explain to me what is going on? And help me to find a solution?

Thank you.

Verified Answer
  • display InventLocationId depot()


       return CustTable::find(orderAccount).InventLocation;


All Replies
  • Hi Irodman,

    I didn't see you declare CustTable, so I assume you did that in other methods.

    This display method always returns the inventlocation of the first selected custTable, and I'm guessing that custTable doesn't have inventlocation assigned.

    If the custTable is initialized in other methods, you just need to return custTable.InventLocation.

  • Hi Andrew,

    I didn't declare it because The system tells me that the CustTable is already declared somewhere. I supposed that it's declared because it is used in the Datasource and the reports takes most of the data from there. But despite the fact that everything looks alright it seems doesn't appear.

  • can you just return a hardcoded string value in that method to see if this is caused by the report or your code logic?

  • There is the CustInventJour Table that is used on that report aswell, that table has an InventLocationId fiel but when I check in the table, that Invent Location is empty. Maybe my report goes there to pick the information despite the fact that I specified that I wanted the my method to take the informations from CustTable. Either way I would like to know what I can do to have my report display the informations from CustTable. My method looks allright I don't understand why it isn't working.

  • I think it compiles because the CustTable is part of the datasources.

    do you use a fecthmethod?


  • display InventLocationId depot()


       return CustTable::find(orderAccount).InventLocation;


  • Thank you all guys for your help. I tried Kent's method and it worked. I would like to know what was wrong with mine though?

    Kent can you tell ma in what way your method succeed where mine failed, so I'd able next time to solve a similar issue if I ever encounter one again?


  • Beside, it only showes the location for some Customers, but for many of them it doesn't despite the fact that there is a locationId for them too, I don't understand why.