TACTIC Open Source
Expression for column with spaces - Printable Version

+- TACTIC Open Source (http://forum.southpawtech.com)
+-- Forum: TACTIC Open Source (http://forum.southpawtech.com/forumdisplay.php?fid=3)
+--- Forum: TACTIC Discussion (http://forum.southpawtech.com/forumdisplay.php?fid=4)
+--- Thread: Expression for column with spaces (/showthread.php?tid=94)



Expression for column with spaces - dankitchen - 04-10-2020

Hi Team,  I have a sType where I created the columns by importing a spreadsheet where some column names had spaces.  It seems to have created the columns with spaces that are ok to reference in the filter part of an expression but not for a column reference in a @GET expression.  An example is:

Code:
email_expr = "@GET(msm/wp_orders['Order Status', 'Processing'].Email Billing)"
email_list = server.eval(email_expr)

I tried a few things and also double-checked in psql that the spaces are there.  I had thought that Tactic replaced the spaes in column names during csv import but seems to not be the case now. 

thanks!
-Dan


RE: Expression for column with spaces - dankitchen - 04-10-2020

I realized one way around this is to do the following but still interested to know if there is a way to address the above issue

order_expr = "@SOBJECT(msm/wp_orders['Order Status', 'Processing'])"
order_list = server.eval(order_expr)

email_list = []

for order in order_list:
email_list.append(order.get("Email Billing"))


email_html = ",".join(email_list)


RE: Expression for column with spaces - listy - 04-11-2020

Hi!
Have you tried using "\s" for space?

Code:
email_expr = "@GET(msm/wp_orders['Order Status', 'Processing'].Email\sBilling)"
email_list = server.eval(email_expr)



RE: Expression for column with spaces - remkonoteboom - 04-15-2020

Yes, I can see the expression parser messing that up. Does listy's suggestion work (I would like to know)?

In general, spaces in column names are "frowned" upon for these kinds of reasons (just like file names). You never know where it will break. However, if (and I mean if ... Wink ) it were to be supported, I would think that it would require something like this:

@GET(msm/wp_orders['Order Status', 'Processing'].'Email Billing') <-- with single quotes around Email Billing.

(NOTE above is not supported, in case anybody reads too quickly)