Product Name in Calculation Question

How do I reference only the name of a product in a Calculation question? When I reference a product answer, I get the following string (generalized): Product Name (SKU)@Price.

In the double brackets, I can reference number purchased, price (line total), or sku, but not the name alone. What am I missing?

Hi there.

If you’re talking about the properties accessed through dot notation in answer piping (e.g. {{ key.quantities.sku }}), then you can actually also do {{ key.names.sku }} for the product name of the product matching the SKU on the product question matching the key.

For example, suppose I have a product question with a key of abc and one product with a name of Product A and a SKU of producta.

I can access that name directly using

{{ abc.names.producta }}

This is in Calculations question, not answer piping within the a question / text.

{{ key.names.sku }} works only if I know the SKU of the option selected.

If I use {{ key.selectedProducts }}, I get the SKU (and only the SKU) of the option that was picked by the end user. If I use {{ }}, I get the total purchased of that option (and only the total). So far as I can tell, there is no way to get just the name of the selected product (without knowing the SKU, which I won’t in a calculation, unless I do something massive.

Is there a way to get the Name of the Product (and only the name of the product) that the end user selected in a calculation question?

[And, just to clarify, I mean in a single direct call. I know that I can split the combined string “Product Name (SKU)@Price” on the ‘(’, but that will only work provided all names are banned (on my end) from using “(”.]

Right, within a calculation.

There isn’t a direct way to conditionally grab the name of the product and also use properties of a product question. You’re right that you can split() the string. If you’re worried about other parentheses in the SKU, for example, you can use split() and then just get() the first element only.