Forum Discussion

MikeTamoush's avatar
MikeTamoush
Qrew Commander
3 years ago

'ToText' equivalent in Jinja

I have a multiple choice field with the options '1,2,3,4'. Since Multiple choice is seen as text, for QB, these aren't actually numbers.

I have a numerical field, [NumberField].

In a pipeline I want to set [Multiple Choice] to [NumberField]. I am trying to set a text multiple choice to a number, and QB doesn't like that. My solution for now is just to create a formula text field with my calculation, ToText the result and use that formula field.

Is there a shortcut to do this all in pipelines? I know below isn't right, but it paints the picture of what I want.

Set [Multiple Choice] to: ToText{{a.NumberField}}

------------------------------
Mike Tamoush
------------------------------
  • Can you try

    {{a.NumberField|string}}

    ------------------------------
    Prashant Maheshwari
    ------------------------------
    • MikeTamoush's avatar
      MikeTamoush
      Qrew Commander

      After I posted this, I googled more and found that. I tried it but no luck. Though, Pipelines accepted it (did not highlight the box as an error), so the format it liked. I am wondering if it's just something about setting the multiple choice field.

      To be clear, the pipeline could save and run, but gets an error at that step saying the input is not valid for that Multiple Choice field.

      ------------------------------
      Mike Tamoush
      ------------------------------

      • MalcolmMcDonald's avatar
        MalcolmMcDonald
        Qrew Cadet
        In my experience, that tends to mean the multiple choice field isn't set to allow user to create new entries and that there's some difference between what's coming out of the jinja and what you have in the field.  I use the format like what is shown above a lot for your use case {{a.NumberField|string}}

        ------------------------------
        Malcolm McDonald
        ------------------------------