Support Article
Non-visual segment generates wrong query and results
SA-10533
Summary
Create a Non-Visual Segment with more than 3 conditions. The query generated has the prepared values mapped in wrong order.
Error Messages
com.pega.pegarules.pub.database.BadTableMappingException: Cannot write property <unknown> to a decimal column--its value, "%.%", is not a decimal: code: <none> SQLState: <none> Message: <none>
From: (B765399371A4E7AD8B1D26986F7890DED)
SQL: INSERT INTO MKTSEGTest (CustomerID) SELECT DISTINCT "PC0".CUSTOMERID AS "CustomerID" FROM PEGANBAM_EXTERNAL.MKT_CUSTOMER "PC0" WHERE ( "PC0".EMAIL NOT LIKE ? AND "PC0".EMAIL LIKE ? AND "PC0".EMAIL LIKE ? AND LENGTH("PC0".EMAIL) > ? )
SQL Inserts: <6> <%@gmail.com%> <%@%> <%.%>
Order of the prepared values was incorrect.
<SQLPopulateSegmentTable>INSERT INTO MKTSEGTest (CustomerID) SELECT "PC0".CUSTOMERID AS "CUSTOMERID" FROM {CLASS: PEGAMKT-DATA-CUSTOMER } "PC0" WHERE ( "PC0".EMAIL NOT LIKE {REPORTDATA.PYPREPAREDVALUES(1)} AND "PC0".EMAIL LIKE {REPORTDATA.PYPREPAREDVALUES(2)} AND "PC0".EMAIL LIKE {REPORTDATA.PYPREPAREDVALUES(3)} AND LENGTH("PC0".EMAIL) > {REPORTDATA.PYPREPAREDVALUES(4) INTEGER} ) </SQLPopulateSegmentTable>
<PreparedValues REPEATINGTYPE="PropertyList">
<rowdata REPEATINGINDEX="1">6</rowdata>
<rowdata REPEATINGINDEX="2">%@gmail.com%</rowdata>
<rowdata REPEATINGINDEX="3">%@%</rowdata>
<rowdata REPEATINGINDEX="4">%.%</rowdata>
</PreparedValues>
Steps to Reproduce
1. Create a Non-Visual Segment
2. ADD Filter condition:
.pyEmail1 does not contain "@gmail.com"
.pyEmail1 contains "@"
.pyEmail1 contains "."
Length of [.pyEmail1] Greater than 6.
3. Run the Segment to observe that the result is 0.
Root Cause
The query firing from Report Definition has unordered prepared values.
Resolution
This issue is resolved by HFix-22205.
Published June 25, 2015 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.