Search code examples
c#phpacumaticawebservices-client

How can i get Data from Screen IN401000 using Webservices


Hello everyone i have this problem i try to get the info from this table (for example one inventoryID and all of the subarticle), but the consult is crashing because it's takes a lot of time.

I'm stuck right now, i have this in php but if someone could help me is fine if is C#

$Gate = new AcumaticaGate($user, $pass);
$schema = $Gate->Client->IN401000GetSchema(new IN401000GetSchema())->GetSchemaResult;
$Gate->Client->IN401000Clear(new IN401000Clear());

$export = new IN401000Export();
$export->commands = array
(
$schema->Selection->ServiceCommands->EveryInventoryID,
$schema->Selection->InventoryID,
//$schema->InventorySummary->DisplayName ,
//$schema->InventorySummary->InventoryID ,
//$schema->InventorySummary->Subitem ,
//$schema->InventorySummary->Warehouse ,
//$schema->InventorySummary->Available ,
//$schema->InventorySummary->BaseUnit,
);
$field = new Field();
$field->FieldName = "InventoryID";
$field->ObjectName = $schema->Selection->InventoryID->ObjectName;

$export->filters = array();

$filter_command = $Gate->PrepareSimpleFilter($field, FilterCondition::Contain, "10091"); // Filtro para buscar los 15 articulos Anteriores
array_push($export->filters,$filter_command);

$export->breakOnError = true;
$export->includeHeaders = false;
$export->topCount = 10;

try
{
    $export_result = $Gate->Client->IN401000Export($export)->ExportResult;
    unset($Gate->Client);
}
catch (Exception $e) {
    console($e);
}

return $export_result->ArrayOfString;

Solution

  • When working with an inquiry screen, you always have to use Submit commit instead of Export. Below is the sample in C# showing how to export data via the Screen-Based API from the Inventory Summary (IN401000) screen for a given inventory item:

    IN401000WebRef.Content itemSumSchema = IN401000context.GetSchema();
    var itemSumCommands = new IN401000WebRef.Command[]
    {
        new IN401000WebRef.Value
        {
            LinkedCommand = itemSumSchema.Selection.InventoryID,
            Value = item[0]
        },
        new IN401000WebRef.Value
        {
            LinkedCommand = itemSumSchema.Selection.ExpandByLotSerialNumber,
            Value = "True"
        },
        itemSumSchema.InventorySummary.Warehouse,
        itemSumSchema.InventorySummary.Location,
        itemSumSchema.InventorySummary.OnHand,
        itemSumSchema.InventorySummary.EstimatedTotalCost,
        itemSumSchema.InventorySummary.LotSerialNumber
    };
    var serials = IN401000context.Submit(itemSumCommands);