SIMITGROUP / phpjasperxml

This is a php wysiwyg report library
BSD 3-Clause "New" or "Revised" License
44 stars 47 forks source link

Print With Expression Not Working #27

Closed hidayat88 closed 5 years ago

hidayat88 commented 5 years ago

Hi, I'm trying to hide and view an image using "Print With Expression" using this expression called from database $F{students_1a}.contentEquals( "Yes" ), but not working. Inside Ireport it is working well.

image Image 1: Expression declared inside Ireport

image Image 2: using Ireport directly the another image hidden and another one showed.

image image 3: PDF generated didnt hide the 'X' image.

kstan79 commented 5 years ago

hi, We not use java, and php dont know the syntax. you shall use syntax as below code:

$F{student_1a}=="Yes"
hidayat88 commented 5 years ago

hi, We not use java, and php dont know the syntax. you shall use syntax as below code:

$F{student_1a}=="Yes"

Hi, I already using that expression, it works with ireport, but not with phpjasperxml. Another one issue, the date format also cannot use some custom format, only standard date and time works.

kstan79 commented 5 years ago

Try

“$F{student_1a}” == “Yes” 

Supported date format you may try open abstractPHPJasperxml.inc.php and go to line 2514, function formatText(). Check your format is it defined inside. if you need more pattern may modify here and send us pull request

hidayat88 commented 5 years ago

I already check that the script is working only for line type. Once using this $F{students_1a}=="Yes" Other types such as image, square, text, eclipse, are not hidden once the condition other than stated.

hidayat88 commented 5 years ago

Maybe I can try & error by modifying the source code to support the image hidden, by adding some attributes and expressions just need to go through the tcpdf documentation. What version of tcpdf used? Once modification done, I'll pulling the request and close this post.

kstan79 commented 5 years ago

hi, i'd check seems it is missing features. you can edit 'PHPJasperXMLElement.inc.php', find keyword 'printWhenExpression'. 'element_Image' seems missing the attribute.

kstan79 commented 5 years ago

i'd approved the PR, please verify that. if work well you may close this issue.

hidayat88 commented 5 years ago

Thanks. It works well. I'd changed the database content into "No" image Image 1: Database content changed to "No" condition.

image Image 2: The generated report shows "X" the jpg image and hide the "/" image.

Next I changed the database to "Yes" image Image 3: Database content changed to "Yes" condition.

image Image 4: The generated report shows "/" the jpg image and hide the "X" image.

That's all. Thanks.