CurStock::GetFirstStockData (Interface: CurStock)
 
Initializes and fills a list of stock data and gets the first item data.
 
VARIANT_BOOL GetFirstStockData (
    BSTR bsArtNum,
    enum eStockDataOrder eStockDataOrder,
    VARIANT* pvWarehouse,
    VARIANT* pvLocation,
    VARIANT* pvSerialNumber,
    VARIANT* pvStock
)
 
Parameters
bsArtNum
[in] The article number of which you want to get a list of stock data. This article number cannot be blank (an exception will be thrown otherwise).
eStockDataOrder
[in] A value of the 'eStockDataOrder' enumeration.
pvWarehouse
[in,out] The warehouse of which you want to get a list of stock data. The meaning of this parameter depends on the given type and value:
VARIANT-type Value
NULL-pointer (C++) or VARIANT of type VT_NULL (other languages) n.a.
  [in]:   Supply this type of VARIANT if
the option 'Stock management' is not active, otherwise an exception will be thrown or
you want stock data independently of the warehouse (= a single total for all warehouses).
  [out]:   Nothing will be returned.
VARIANT of type VT_EMPTY n.a.
  [in]:   Supply this type of VARIANT if
the option 'Stock management' is active and
you want stock data for all warehouses (= a total for each warehouse).
  [out]:   A VARIANT, subtype BSTR, containing the warehouse of the first item in the list. This value is only reliable if the method returns True.
VARIANT of type VT_BSTR code of the specific warehouse
  [in]:   Supply this type of VARIANT if
the option 'Stock management' is active and
you want stock data for the given warehouse only.
  [out]:   A VARIANT, subtype BSTR, containing the warehouse (will always be the given warehouse) of the first item in the list. This value is only reliable if the method returns True.
pvLocation
[in,out] The location of which you want to get a list of stock data. The meaning of this parameter depends on the given type and value:
VARIANT-type Value
NULL-pointer (C++) or VARIANT of type VT_NULL (other languages) n.a.
  [in]:   Supply this type of VARIANT if
the option 'Stock management' is not active, otherwise an exception will be thrown or
you want stock data independently of the location (= a single total for all locations).
  [out]:   Nothing will be returned.
VARIANT of type VT_EMPTY n.a.
  [in]:   Supply this type of VARIANT if
the option 'Stock management' is active and
you want stock data for all locations (= a total for each location).
  [out]:   A VARIANT, subtype BSTR, containing the location of the first item in the list. This value is only reliable if the method returns True.
VARIANT of type VT_BSTR code of the specific location
  [in]:   Supply this type of VARIANT if
the option 'Stock management' is active and
you want stock data for the given location only and
the parameter pvWarehouse contains a specific warehouse as well, otherwise an exception will be thrown.
  [out]:   A VARIANT, subtype BSTR, containing the location (will always be the given location) of the first item in the list. This value is only reliable if the method returns True.
pvSerialNumber
[in,out] The serial number of which you want to get a list of stock data. The meaning of this parameter depends on the given type and value:
VARIANT-type Value
NULL-pointer (C++) or VARIANT of type VT_NULL (other languages) n.a.
  [in]:   Supply this type of VARIANT if
the option 'Serial numbers' is not active, otherwise an exception will be thrown or
you want stock data independently of the serial number (= a single total for all serial numbers).
  [out]:   Nothing will be returned.
VARIANT of type VT_EMPTY n.a.
  [in]:   Supply this type of VARIANT if
the option 'Serial numbers' is active and
you want stock data for all serial numbers (= a total for each serial number).
  [out]:   A VARIANT, subtype BSTR, containing the serial number of the first item in the list. This value is only reliable if the method returns True.
VARIANT of type VT_BSTR code of the specific serial number
  [in]:   Supply this type of VARIANT if
the option 'Serial numbers' is active and
you want stock data for the given serial number only and
the parameter eStockDataOrder was not set to sdoByLocation, sdoByPriority or sdoByPriority_CircuitCode, otherwise an exception will be thrown.
  [out]:   A VARIANT, subtype BSTR, containing the serial number (will always be the given serial number) of the first item in the list. This value is only reliable if the method returns True.
pvStock
[out] Returns a VARIANT, subtype DOUBLE, containing the current stock of the given article. This value is only reliable if the method returns True.
 
Return value
True if a list of stock data can be created and this list contains data, otherwise False.
 
Remarks
How to pass a NULL-pointer or a VARIANT of type 'VT_NULL'?
C++
Pass 'NULL' as parameter value, which results in a NULL-pointer.
C#
Pass 'System.DBNull.Value' as parameter value, which results in a VARIANT of type 'VT_NULL'.
VBS
Pass 'null' as parameter value, which results in a VARIANT of type 'VT_NULL'.
VBN
Pass 'System.DBNull.Value' as parameter value, which results in a VARIANT of type 'VT_NULL'.
 
See Also
CreateCurStock
GetNextStockData
 
Samples
 
C++
 
// Get a list of all stock data for the article with number 'Art_001' with serial number 'Ser_001' (in all warehouses and on all locations), navigating the list in order of serial number and location.
COleVariant oleVar;
VARIANT    vWarehouse, vLocation, vSerialNumber, vStock;

oleVar.SetString ("Ser_001", VT_BSTR);
vSerialNumber = oleVar.Detach ();

if (pCurStock->GetFirstStockData ("Art_001", sdoBySerialNumber_Location, &vWarehouse, &vLocation, &vSerialNumber, &vStock))
{
    // Process data
}

C#
 
// Get a list of all stock data for the article with number 'Art_001' with serial number 'Ser_001' (in all warehouses and on all locations), navigating the list in order of serial number and location.
object oWarehouse = null, oLocation = null, oSerialNumber = "Ser_001", oStock;
if (oCurStock.GetFirstStockData ("Art_001", eStockDataOrder.sdoBySerialNumber_Location, ref oWarehouse, ref oLocation, ref oSerialNumber, out oStock))
{
    // Process data
}

VBS
 
' Get a list of all stock data for the article with number 'Art_001' with serial number 'Ser_001' (in all warehouses and on all locations), navigating the list in order of serial number and location.
Dim oWarehouse, oLocation, oSerialNumber, oStock

oSerialNumber = "Ser_001"

If oCurStock.GetFirstStockData("Art_001", sdoBySerialNumber_Location, oWarehouse, oLocation, oSerialNumber, oStock) Then
    ' Process data
End If

VB.NET
 
' Get a list of all stock data for the article with number 'Art_001' with serial number 'Ser_001' (in all warehouses and on all locations), navigating the list in order of serial number and location.
Dim oWarehouse, oLocation, oSerialNumber, oStock As Object

oSerialNumber = "Ser_001"

If oCurStock.GetFirstStockData("Art_001", eStockDataOrder.sdoBySerialNumber_Location, oWarehouse, oLocation, oSerialNumber, oStock) Then
    ' Process data
End If