LimeReport icon indicating copy to clipboard operation
LimeReport copied to clipboard

[Feature Request] Image.resourcePath as a Script

Open 7ymekk opened this issue 4 years ago • 1 comments

Hi Alex,

in following issue I've noticed you added support for resourcePath to be a variable: https://github.com/fralx/LimeReport/issues/171

but it would be perfect if image could support all of the features: data, variable and script.

Use Case: I have multiple row summary with status_id: None, Ok and Fail. For all statuses I have functions:

function okIconPath() {
	return resourcesPath + "status_ok.svg"
}

function failIconPath() {
	return resourcesPath + "status_fail.svg"
}

function noTestconPath() {
	return resourcesPath + "status_none.svg"
}

function iconForTestStatus(testStatus) {
	if (testStatus == 4)
		return okIconPath()
	if (testStatus == 3 || testStatus == 5 || testStatus == 6) 		
		return failIconPath()
	return noTestconPath()
}

I know I could use html text item with content like that:

$S{
"<img src=" + iconForTestStatus($D{test_summary_table.overal_status_icon}) + '></img>'
}

but the graphics is raster and doesn't look good. I would like to have parametrized SVG image but whenever I set $S{okIconPath()} to SvgItem.resourcePath, it's not showing anything. Do you think it could be fixed/added easily? Or maybe I'm doing something wrong?

7ymekk avatar Aug 24 '20 11:08 7ymekk

I created:

  • SVGItem with: objectName=svgStatusIcon, resourcePath=$S{okIconPath()}
  • TextItem with: content=$S{SummaryPage_svgStatusIcon.resourcePath}

it looks like TextItem is printing out correct icon path, so /opt/reports/resources/status_ok.svg but it's not using it to load graphics

7ymekk avatar Aug 25 '20 11:08 7ymekk