Page 1 of 1

Connecting to another company database

Posted: Wed Mar 12, 2008 4:24 pm
by coldrick
Situation:
Two companies in CAPITAL
Some products stocked by the two companies overlap using the exact same part number

Question:
Is it possible for the stock lookup screen to link to the other company stock.dbf database to show their available quantities?

Posted: Thu Mar 13, 2008 1:04 pm
by COBS Tech Support
This should be possible but would require at least the Enterprise or Corporate Editions.

Firstly, you would need to add your own 'user' column to the find/look-up window. The topic: "Stock Find User Column Hook (R-SFColn.MAC)" explains how to do this.

Secondly, you would need to open the second stock file within the column. You can use the OpenTable() function to do this (consult the Visual Builder help file) but you would need to specify both a path and an alias, i.e.,

OpenTable(PathData() + "Company2\Stock.dbf", "Stock2")

Then use Find() to locate what you are after, i.e.,

Stock2->(Find(Stock->Name))

Posted: Thu Mar 13, 2008 7:21 pm
by coldrick
I'm only fairly new to the scripting, but I got this working.

Declare StockAtB Type Character
OpenTable("Z:\CAPITAL\TESTCO2\Stock.dbf", "Stock2")
Stock2->(Find(Stock->Name))
StockAtB := Stock2->Stock_In
Return { "Stock at Other Company", "Stock LOC2", 12, 2, 15, StockAtB }

Thanks.