Tu Trinh
Tu Trinh

Reputation: 157

How do search field type="dynamic" using Flexible Search in Hybris Jasper report?

For example:

    SELECT 
 {adjustment.pk},
 {reason.code},
 {reason.description},
 {adjustment.orderNumber}
 {adjustment.creator},
 {cs.agentID},
 {cs.mobilePhone}
  FROM  {OrderValueAdjustment as adjustment JOIN AdjustOrderReason AS reason ON {adjustment.reason} = {reason.pk}
    JOIN CsEmployee AS cs ON  {adjustment.creator} = {cs.pk}
  }
WHERE {adjustment.pk} = 8796093131124

throw false because {adjustment.orderNumber} is dynamic attribute type.

Upvotes: 1

Views: 1650

Answers (2)

alain.janinm
alain.janinm

Reputation: 20065

Dynamic attributes are not saved in the DB so you can't get them using FLexible Search.

To solve yur issue with Jasper report, if you look closer at a jrxml file (salesByCountry.jrxml for example), you'll see this part :

<queryString>
            <![CDATA[SELECT x.COUNTRY AS COUNTRY, SUM(x.TOTPRICE) as TOTPRICE
FROM
({{
Select {country.name} as COUNTRY, COALESCE(sum({o.totalPrice} * {c2.conversion}/{c.conversion}),0) as TOTPRICE
from { Country AS country LEFT JOIN Address AS a ON {a.country}={country.PK} LEFT JOIN Order AS o ON {o.paymentAddress}={a.PK} LEFT JOIN Currency as c ON {o.currency}={c.PK} LEFT JOIN Currency as c2 ON {c2.pk}= $P{Currency} AND {o.creationtime} >= $P{From} AND {o.creationtime} < $P{To}}
GROUP BY {country.PK}, country
}}
UNION ALL
{{
Select {country.name} as COUNTRY, COALESCE(sum({o.totalPrice} * {c2.conversion}/{c.conversion}),0) as TOTPRICE
from { Country AS country LEFT JOIN Address AS a ON {a.country}={country.PK} LEFT JOIN Order AS o ON {o.paymentAddress}={a.PK} LEFT JOIN Currency as c ON {o.currency}={c.PK} LEFT JOIN Currency as c2 ON {c2.pk}= $P{Currency} AND {o.creationtime} >= $P{From} AND {o.creationtime} < $P{To} AND {o.paymentAddress} IS NULL}
GROUP BY {country.PK}, country
}}) x
GROUP BY COUNTRY
ORDER BY TOTPRICE DESC]]>
        </queryString>

What you can do is replace the data retrieve using this flexible search by parameter (as Currency in the jrxml). You then just have to get the dynamic value from the model in java and pass it to your jasper report using the parameter map.

Upvotes: 0

Vikrant
Vikrant

Reputation: 1889

Dynamic attributes are not persistent attributes, therefore they could not be searched using a flexi query.

Upvotes: 2

Related Questions