[ic] DB query using scratch variable

DB db at m-and-d.com
Thu Mar 2 16:14:58 UTC 2023


I have a scratch variable set for which

sku_prefix = |[scratch sku_prefix]|     (using the pipe delimiters to 
help me see extra white space) displays:

sku_prefix = | BS |

I'm not sure why the white space exists and can't seem to get rid of it.


This:
data1= |[data interpolate=1 table=cat col=source foreign=sku_prefix key=BS]|

displays as expected
data1= |CPS|

but
data2= |[data interpolate=1 table=cat col=source foreign=sku_prefix 
key=[scratch sku_prefix]]

displays
data2= |]|


I get similar issues if I try the query in a perl block. The below works 
but I fails when I try to replace BS with [scratch sku_prefix] or with 
$Scratch->{sku_prefix};

        [tmp mysource]
          [perl tables="cat"]
            ($Db{cat}->query("SELECT distinct `source` FROM cat WHERE 
sku_prefix = 'BS'"))[0][0][0];
          [/perl]
        [/tmp]
HEY [scratch mysource]


More information about the interchange-users mailing list