I'm not sure why this is happening, so if anyone can provide some insight,
that'd be greatly appreciated.
I have a procedure calling another procedure. And the 2nd procedure is
changing the value of a variable in the parent procedure when it shouldn't
be. It's an easy issue to code around. I can use a hold variable to fix it's
value, but I'd like to know why this is happening.
I'm not sure how much info is needed to understand what's going on here, so
here's pretty much everything.
I have a mobile application that allows users to update info in a SQL
database on a server via a web service.
(Procedures listed below.)
One specific procedure takes two input parameters sLocTagNumber and
sLocation.
In this procedure, it calls the procedure UpdateTagLocation (which is
responsible for actually talking to the web services and updating the
information) and passes these two same values to it.
Update tag location uses a different variable name for it's first parameter
because in some scenarios, it's possible for UpdateTagLocation() to changes
it's internal value for sTagNumber. This is where the problem is happening.
It never touches sLocTagNumber in code however.
For example The line SWITCH UpdateTagLocation(sLocTagNumber,sLocation) is
sending the value "43326A" for sLocTagNumber.
During UpdateTagLocation() sTagNumber is getting changed from "43326A" to
"32114"
When the code comes back out of UpdateTagLocation() back to the switch
statement. sLocTagNumber has changed to "32114"
If anyone has any insight on why this is happening. I'd love to know. Thanks!
PROCEDURE StageTag(sLocTagNumber is string, sLocation is string)
IF sLocTagNumber <> "" AND sLocTagNumber <> 0 AND sLocation <> "" THEN
sLocTagNumber = NoCharacter(sLocTagNumber,CRLF)
ArraySeek(garrStagingLocations,asLinearFirst,NoSpace(Upper(sTagNumber)))
SWITCH UpdateTagLocation(sLocTagNumber,sLocation)
is getting changed
CASE 0:
nLoopLocation is int = LooperSeek(ATT_TagNumber,"TAG: " +
sLocTagNumber,searchExactMatch)
LOOP_PickData[nLoopLocation].ATT_StageBtnVisible = False
LOOP_PickData[nLoopLocation].ATT_Watermark = True
WIN_MachinePickList.garrTagInfo[ArraySeek(WIN_MachinePickList.garrTagInfo,asLinear,"TagNumber",sLocTagNumber)]:PlantLocation
= sLocation
IF InTestMode() = True THEN
Trace("Tag:"+ sLocTagNumber + " staged to " + sLocation)
END
CASE 1:
CASE 2:
Info("""" + sLocTagNumber + """" + " is not a valid location")
OTHER CASE
END
END
PROCEDURE UpdateTagLocation(sTagNumber is string, sLocation is string)
End