Workaround for PrimitiveExp:: MakePrimitive Caused by IFNULL and a Zero Length String in Tableau

Data

Workaround for PrimitiveExp:: MakePrimitive Caused by IFNULL and a Zero Length String in Tableau

by David Wagner
//

Recently, a colleague ran into an issue with the workbook that is exported from our Audit tool in our Workbook Tools product:

The error is Tableau Data Engine Error: 4: PrimitiveExp::MakePrimitive: map_lower_user2_val.

Findings

When I investigated, I discovered that it was caused by a bug in Tableau 9.0. In our workbook, we have a calculated field with the following formula:

CONTAINS(LOWER(IFNULL([Dashboard Name],"")), LOWER([Dashboard]))

CONTAINS(LOWER(IFNULL([Dashboard Name],"")), LOWER([Dashboard]))

Dashboard is a string parameter that we use to provide the search functionality at the top of the dashboard pictured above. The error occurs when IFNULL evaluates TRUE and the LOWER function throws the exception. If you pass a zero length string directly into LOWER, i.e. LOWER(“”), it performs as expected. It only breaks when IFNULL return a zero length string.

Workaround

My workaround in this instance was to TRIM the zero length string in the true part of the IFNULL, so the new formula became:

CONTAINS(LOWER(IFNULL([Dashboard Name],TRIM(“”))), LOWER([Dashboard]))

CONTAINS(LOWER(IFNULL([Dashboard Name],TRIM(""))), LOWER([Dashboard]))

You might be able to also use a space as the null replacement if you just need white space, making the TRIM function unnecessary. But in our instance, we needed a zero length string. I hope this helps anyone unfortunate enough to run into this bug.

Note: If you are using Workbook Tools and have ran into the issue in the Tableau workbook exported by the Audit tool, the implemented workaround will be released in version 1.7.2.

More About the Author

David Wagner

Software Engineer
Workaround for PrimitiveExp:: MakePrimitive Caused by IFNULL and a Zero Length String in Tableau Recently, a colleague ran into an issue with the workbook that is exported from our Audit tool in our Workbook Tools product: The error ...
The 2009 Oklahoma Oil and Gas Trade Expo I attended the 2009 Oklahoma Oil and Gas Trade Expo yesterday with Tyler Remington, our LandBoss salesman, and Aaron Confer, our ...

See more from this author →

Subscribe to our newsletter

  • I understand that InterWorks will use the data provided for the purpose of communication and the administration my request. InterWorks will never disclose or sell any personal data except where required to do so by law. Finally, I understand that future communications related topics and events may be sent from InterWorks, but I can opt-out at any time.
  • This field is for validation purposes and should be left unchanged.

InterWorks uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy. Review Policy OK

×

Interworks GmbH
Ratinger Straße 9
40213 Düsseldorf
Germany
Geschäftsführer: Mel Stephenson

Kontaktaufnahme: markus@interworks.eu
Telefon: +49 (0)211 5408 5301

Amtsgericht Düsseldorf HRB 79752
UstldNr: DE 313 353 072