Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Params Syntax question
Wed, Aug 12 2015 4:57 PMPermanent Link

Michael Saunders

I have found many answers to my needs form these great forums however I cannot find the answer to this what I think shold be very simple

The following works when StockItem is a string but I cannnot see how to do this if StockItem is an integer

      tbStockLookup.Params.Clear;
      tbStockLookup.Params.Add('StockItem='''+edStockLookup2.text+'''');
      Database.LoadRows(tbStockLookup);

Thanks

Mike
Wed, Aug 12 2015 5:04 PMPermanent Link

Uli Becker

Michael,

> I have found many answers to my needs form these great forums however I cannot find the answer to this what I think shold be very simple
>         tbStockLookup.Params.Clear;
>         tbStockLookup.Params.Add('StockItem='''+edStockLookup2.text+'''');
>         Database.LoadRows(tbStockLookup);

       tbStockLookup.Params.Clear;
       tbStockLookup.Params.Add('StockItem=' + IntToStr(Value));
       Database.LoadRows(tbStockLookup);

Uli
Wed, Aug 12 2015 5:27 PMPermanent Link

Uli Becker

Or (if you want to use the value of an edit field)

      tbStockLookup.Params.Clear;
      tbStockLookup.Params.Add('StockItem=' + edStockLookup2.text);
      Database.LoadRows(tbStockLookup);

Uli
Wed, Aug 12 2015 5:38 PMPermanent Link

Michael Saunders

Uli Becker wrote:

Michael,

> I have found many answers to my needs form these great forums however I cannot find the answer to this what I think shold be very simple
>         tbStockLookup.Params.Clear;
>         tbStockLookup.Params.Add('StockItem='''+edStockLookup2.text+'''');
>         Database.LoadRows(tbStockLookup);

       tbStockLookup.Params.Clear;
       tbStockLookup.Params.Add('StockItem=' + IntToStr(Value));
       Database.LoadRows(tbStockLookup);

Uli

You put me on the right track but I have got it working as  follows

tbTabletInvoice.Params.Add('TabletID='+edReopen.Text);

what confuses me is all those quotes in the following

tbStockLookup.Params.Add('StockItem='''+edStockLookup2.text+''''  );

I dont suppose you can explain what they all mean



Thanks
Wed, Aug 12 2015 6:06 PMPermanent Link

Uli Becker

Michael,

it's quite simple if you  imagine the resulting param string.

For string values:  MyParam='MyValue'
For integer values:  MyParam=1

When you compose the paramstring, you have just to use the matching number of quotes:

For string values: Params.add('MyParam=''' + StringValue + '''')
For integer values: Params.add('MyParam=' + IntegerValueAsString);

String params always with quotes, integer params without quotes, but casted as strings.

Hope that helps.

P.S. The number of quotes is not tested, just written on my tablet. Smile

Uli
Image