Seems like you would want a relationship in your interface file linking the two tables.
If all else fails, you can script this:
- Use set variable to capture the CompanyID in a variable
- Go to a layout for orders
- Perform a find for all orders with that companyID by specifying the value stored in the variable.
- Get ( FoundCount ) will then count the number of orders for that company.
Using a relationship, you wouldn't need a script at all in many cases.
I do have relationship in interface file linking Company table and Order table.
However, since there are no actual tables in interface table, how would you achieve that?
I tried to create a field in Orders in data file and tried to put the lookup but could not do it due to no relationship set in the data file.
It depends on how you want to count your records.
One option is to define a summary field as the "count of" some field in the orders table that is never empty such as the Order ID field.
Then a one row portal to Orders on you company layout can display this summary field and it will count the number of orders for this company.
This is just one out of several possible approaches.
That was explain in the other idential post on this question. I am not sure why but it seems my explanation wasn't satisfactory.
"However, since there are no actual tables in interface table, how would you achieve that?"
As I explained, you can add that data file to your Interfaces file using File > External Data Source. Then in your graph, select the data file and your Orders table then select your Company table. Join them in this Interfaces file. The a summary field from Orders, placed on a layout of Company (in the Interface file) will display the results. :^)
"Then a one row portal to Orders on you company layout can display this summary field and it will count the number of orders for this company."
I thought this thread sounded familiar. And another good catch on the portal detail. I was indeed thinking in terms of a filtered portal when I first composed my response, but then realized while I was typing it that no filter was required. Just didn't follow the thought through to leave out the portal all together.