Jump to content

Debbie Erickson

  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. Debbie Erickson

    Debug error Meaning?

    Hi. I'm getting a strange (to me) error when debugging a project. The project contains an application and a dll. I have both subprojects open in a project group. I have set some breakpoints in a function within the dll. The functions are initially called from the application. In the dll's function, I have a local variable that's being assigned to. Immediately after the assign statement, I tried to inspect what was in the local variable. The local variable is of a custom-defined class type. When I hit the breakpoint to see what is in that variable called "vo", I get an error message of "error inspecting vo - expression error" Is this related to my debugger settings? In the project, I turned off optimization. Can somebody maybe help me understand and fix this? The first loop checks for a count on a list. The debugger is showing that the count is 1. So the assignment of position 0 should have retrieved the data to the local variable of "vo". Below the code are my project settings for the debugging. function UpdateVendOrdCarrier(Order: TsqlOrderRecord; aVendorCode: string = ''; showWarning: boolean = false): boolean; var i: integer; j: integer; k: integer; CurrCarrierType: char; CurrCarrier: string; CurrShipCode: string; CurrShipMinWk: byte; CurrShipMaxWk: byte; cst: TsqlCustomerRecord; vo: TsqlVendOrdRecord; ShipToState: string; ShipToZip: string; //ManualCarrier: boolean; vsp: TVendorShippingPointRecord; NonStandardWarehouseUsed: boolean; nonDefaultWareHouseCarrId: Integer; carriers: TCarrierList; dcId: string; changed: boolean; lastUsedDc: string; warnings: string; begin changed := FALSE; // for all vendors, recheck the Carriers, this could be because of ShipTo Changes // or we added an Item that changes the Carrier for this Vendor Order result := false; for i := 0 to Order.VendOrdList.count - 1 do begin vo := Order.VendOrdList[i]; if ((aVendorCode = '') or ((aVendorCode <> '') and (vo.VendorCode.data = aVendorCode))) and ((not (vo.RecordState in [rsDelete, rsDeleted]))) // No Changes to invoiced Vendor Orders and ((vo.Status.data = ' ') or (Order.OrderType.data = 'Q')) then begin // Use the Ship To Customer State ShipToState := Order.ShipToCustRec.State.data; ShipToZip := Order.ShipToCustRec.ZipCode.data; // If there is an Installer then use the Installers State for k := 0 to Order.CustomerList.count - 1 do begin if (not (Order.CustomerList[k].RecordState in [rsDelete, rsDeleted])) and (Order.CustomerList[k].TypeCode.data = 'I') then begin cst := TsqlCustomerRecord.CreateAndLoadCustomer(Order.CustomerList[k].CustomerOID.data); ShipToState := cst.State.data; ShipToZip := cst.ZipCode.Data; FreeAndNil(cst); break; end; end; CurrCarrierType := ' '; CurrCarrier := vo.ActlCarrier.data; //ManualCarrier := (vo.Carrier.data <> '') and (vo.ActlCarrier.data <> '') and // (vo.ActlCarrier.data <> vo.Carrier.data); // if uOrderCarrierService.TOrderCarrierService.Instance.ManuallyCarrierChangesOnly(vo, NonStandardWarehouseUsed) then // CurrCarrierType := vo.CarrierType.data; CurrShipCode := vo.ShipCode.data; CurrShipMinWk := vo.ShipMinWk.data; CurrShipMaxWk := vo.ShipMaxWk.data; NonStandardWarehouseUsed := false; vsp := vo.VendorRecord.ShippingPointList.GetShippingPoint(ShipToState); lastUsedDc := ''; if not assigned(vsp) then begin // ShipToState := CurrentLocation.CoAddr.State.data; vsp := vo.VendorRecord.ShippingPointList.GetShippingPoint(CurrentLocation.CoAddr.State.data); end; for j := 0 to vo.VendDtlList.Count - 1 do begin if assigned(vsp) and (vo.VendorCode.data = 'TDQ') and (vsp.DCIdentifier.data <> vo.VendDtlList[j].DCIdentifier.data) then begin if WarehouseManagementSystem.DCCanShip(vsp.DCIdentifier.Data) and WarehouseManagementSystem.DCCanShip(vo.VendDtlList[j].DCIdentifier.data) then begin if (not TCarrierList.IsCollectCarrier(vo.ActlCarrier.Data)) then NonStandardWarehouseUsed := true; // <> 'CLCT'; dcId := vo.VendDtlList[j].DCIdentifier.data; end else if WarehouseManagementSystem.DCCanShip(vo.VendDtlList[j].DCIdentifier.data) then begin if (length(lastUsedDc) > 0) and (lastUsedDc <> vo.VendDtlList[j].DCIdentifier.data) then NonStandardWarehouseUsed := True else if not WarehouseManagementSystem.DCUsesCarrier(vo.VendDtlList[j].DCIdentifier.data, vo.ActlCarrier.data) then NonStandardWarehouseUsed := True; lastUsedDc := vo.VendDtlList[j].DCIdentifier.data; end; end; end; if (assigned(vo.VendOrdLastMileCarrierRecord) and (not string.IsNullOrWhiteSpace(vo.VendOrdLastMileCarrierRecord.ProviderName.Data))) then begin AdjustLeadTimesForLMC(vo); CurrShipMinWk := vo.ShipMinWk.data; CurrShipMaxWk := vo.ShipMaxWk.data; end; if uOrderCarrierService.TOrderCarrierService.Instance.ManuallyCarrierChangesOnly(vo, not NonStandardWarehouseUsed, function(venddtlLine: TsqlVendDtlRecord): boolean var tmsContext: TTmsContext; begin tmsContext := TTmsContext.CreateNew(vo); try SystemSetVendDtlCarrierLine(tmsContext, venddtlLine, result); finally FreeAndNil(tmsContext); end; end ) then begin CurrCarrierType := vo.CarrierType.data; end; for j := 0 to vo.VendDtlList.Count - 1 do begin // After and Item is added, this function gets called and we may have a // combination of N, T or I on the Items. // After F4 Carrier selection, this functioon is also called, // but the Carrier For will set the CarrierType on all of the existing Items // to match the carrier type of the selected carrier. if (not (vo.VendDtlList[j].RecordState in [rsDelete, rsDeleted])) and (vo.VendDtlList[j].Status.data <> 'X') and (vo.VendDtlList[j].VendorCode.data = vo.VendorCode.data) then begin case vo.VendDtlList[j].carrierType.Data of 'N': if CurrCarrierType = ' ' then CurrCarrierType := 'N'; 'T': if CurrCarrierType in [' ', 'N'] then CurrCarrierType := 'T'; 'I': if CurrCarrierType in [' ', 'N', 'T'] then CurrCarrierType := 'I'; end; if vo.VendDtlList[j].ShipMaxWk.data > CurrShipMaxWk then begin CurrShipMinWk := vo.VendDtlList[j].ShipMinWk.data; CurrShipMaxWk := vo.VendDtlList[j].ShipMaxWk.data; end; if pos(vo.VendDtlList[j].ShipCode.Data, 'ISO') > pos(CurrShipCode, 'ISO') then CurrShipCode := vo.VendDtlList[j].ShipCode.Data; end; end; if (not vo.ManLeadTime.data) or (trim(vo.ShipCode.AsString) = '') then begin changed := changed or (vo.ShipCode.AsString <> currShipCode) or (vo.ShipMinWk.Data <> currShipMinWk) or (vo.ShipMaxWk.data <> currShipMaxWk); vo.ShipCode.AsString := CurrShipCode; vo.ShipMinWk.data := CurrShipMinWk; vo.ShipMaxWk.data := CurrShipMaxWk; end; HandleNonDefaultWarehouseMoves(changed, vo, CurrCarrierType, NonStandardWarehouseUsed); HandleDefaultCarrierChanges(changed, Result, Order, vo, ShipToState, ShipToZip, CurrCarrierType, NonStandardWarehouseUsed, j); DcDeliveryProgramService.TDCDeliveryProgramService.Instance.UpdateCarriersForDcDeliveryProgram(vo.OrderRecord, ((CurrCarrier <> vo.ActlCarrier.data) and not (TDCDeliveryProgramService.Instance.CarrierManaullySet(vo)) ) ); ExpectedArrivalDateService.TExpectedArrivalDateService.Instance.UpdateArrivalDateIfNeeded(vo); UpdateTmsCarrierSettings(vo, true); TOrderSystemLibrary.Instance.EnsureCurrentFeightValues(vo); if aVendorCode <> '' then break; end; end; // only display the carrier options changed if something really changed. changed := changed and ( (vo.ShipCode.AsString <> currShipCode) or (vo.ShipMinWk.Data <> currShipMinWk) or (vo.ShipMaxWk.data <> currShipMaxWk) or (vo.Carrier.Data <> CurrCarrier) or (vo.CarrierType.Data <> CurrCarrierType) ) ; if changed and showWarning then begin NBFDialogs.NBFMessageDlg(format('%s: Carrier options carrier has been changed, Please confirm delivery options.', [vo.VendorCode.Data]), mtWarning, [mbok], mrok, 0, false, 'Verify Carrier Options'); end; end;