Help with old code

This works to look up a price and divide it by 2:

Field AdvancedPricing

But this (which I’ve tried in various versions) doesn’t work. I need to be able to prepend some text and what used to work (I have old code from Pan 6) isn’t working now:

FormulaFill “~Retail~~1~0.0000~”+str(lookupselected(“PriceSource”,“ItemNum”,ItemNumber,val(“Retail”)/2),0)

Thanks in advance as always!

Barry, you have a working formula.

In your second code sample you should use exactly the same syntax:

FormulaFill "~Retail~~1~0.0000~"+str(lookupselected("PriceSource",«ItemNum»,«ItemNumber»,val(«Retail»),0)/2),0)

Trying your suggestion (which would make me happy, believe me!) is generating a “syntax error.”

Looks like Kurt added an extra “,0)” to the end of the formula.Try:

FormulaFill "~Retail~~1~0.0000~"+str(lookupselected(“PriceSource”,«ItemNum»,«ItemNumber»,val(«Retail»),0)/2)

Now fixed. Here’s the whole code fragment:

FormulaFill “~Retail~~1~0.0000~”+str(lookupselected(“PriceSource”,«ItemNum»,«ItemNumber»,val(«Retail»),0,0)/2)






for reasons I don’t know, field names in quotes were causing errors. When I replaced them with the chevron thingies, the errors stopped. By the way, what is the keyboard shortcut for those? «»
thanks again,

Well, on my German QWERTZ keyboard you would type the “«” character with opt-Q, the “»” character with shift-opt-Q.


1 Like