Terry,

not sure about why you need to add new columns to csrFacMastPlus if this
is temporary table - and if not, then you will run the risk of getting an
error because the fields are present.

But on your question:
Perhaps you could do the lot with a selection first.

Select * from FacMast, FacDesc
     Where FacMast.RowID = lnRowID AND  FacMast.Fac_Code = FacDesc.Fac_Code
into SEL_TEMP

 If SelectionInfo( SEL_INFO_NROWS) > 0 then
          Insert into csrFacMastPlus
          Select * from Selection 'or the columns you want.
End If

Or if there is a possibility that you won't have a description in FacDesc
for every Fac_Code, or you want to use more than one look-up,
you could use an update column.


Select * from FacMast Where FacMast.RowID = lnRowID Into SEL_TEMP
 If SelectionInfo( SEL_INFO_NROWS) > 0 then
      Add Column "SEL_TEMP" (FT_Desc Char (35))
        From FacDesc Set To Desc Where Fac_Code = FacCode  Dynamic
  more updates of other fields.

   Then insert your record from SEL_TEMP into csrFacMastPlus

You can experient with the update table command with your mapbasic window
open to get the syntax right.

r


> Hi Listers
>
> Consider the following code:
> _____________________________
> Select * from FacMast
>       Where RowID = lnRowID
> Insert into csrFacMastPlus
>       Select * from Selection
> Commit Table csrFacMastPlus
> Alter Table csrFacMastPlus ( Add      Zone_Desc       Char( 40),
>                                               FT_Desc Char( 35),
>                                               ZG_Desc Char( 50))
> Commit Table csrFacMastPlus
>
> If SelectionInfo( SEL_INFO_NROWS) > 0 then
> ' then found the correct row
>       lnFacCode       = FacMast.Fac_Code
>       lnZone          = FacMast.Zone
>       lcCatchZG       = FacMast.CatchZG
>       Select Desc from FacDesc
>               where FacDesc.Fac_Code = lnFacCode
>               into csr1 NoSelect
>       If SelectionInfo( SEL_INFO_NROWS) > 0 then
>               browse * from csr1
>               Update csrFacMastPlus
>                       Set FT_Desc = csr1.Desc
> <--------------------------!!!!!!!!!!!!!!!
>       End If
>       ...
> End If
> _________________________________
>
> When it gets to the line marked with the arrow I get the error "variable
> or field csr1.Desc not defined"
> This is despite the fact that:
> 1)  It wouldn't get to that line if the SelectionInfo() failed
> 2)  The Browse shows a column "Desc", and the browse window heading is
> "crs1"
>
> I've tried it with Selection.csr1 - same error only "Selection.Desc"
> I suspected I didn't need the second commit statement, so it had been
> ommitted but the error message them prompted me to put it in.
>
> This is all part of my daily "firefighting" with this language, rather
> than progressing, and I've run out of permutations/ideas.
> Can anybody tell me what the problem is?
>
> 'ppreciate it
>
> Terry McDonnell
>
> _______________________________________________
> Mapinfo-l mailing list
> [email protected]
> http://www.directionsmag.com/mailman/listinfo/mapinfo-l
>

_______________________________________________
Mapinfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to