Agenda Group not working with drools 8.29.FINAL version - drools

We have java rules service microservice & Using drools 7.X version to process the dynamic rules process. business rules (.xlsx) file using the Agenda-groups which is working fine.
After upgrading to drools 8.29.FINAL. kiesession.getAgenda().setAgendaFocus("1") is returning null.
NOTE :
Drools 7.49 is giving me list of agenda's
kieContainer.getKieBase().getKiePackages().parallelStream()
.forEach(obj -> obj.getRules().stream().forEach(innerObj -> {
agendaGroups.add(KieRuleMetaData.builder().agendaGroup(((RuleImpl) innerObj).getAgendaGroup())
.ruleName(innerObj.getName()).build());
}));
After upgrading to 8.29.FINAL - it's notworking
Appreciate if any help
As per the documentation, changed only drools version on pom.xml file.

Without some reproducer, it is difficult to support you effectively; next time kindly consider providing a reproducer (on GitHub for example) and share it here or via mailing-list on drools-usage or kogito-development
To me, this snippet returns as expected the agenda-group(s) defined in the rules, using 8.33.0.Final in this little reproducer here: https://github.com/tarilabs/demo20230212-so75416633/blob/main/src/test/java/org/drools/demo/RuleTest.java#L32-L34
kContainer.getKieBase().getKiePackages().stream().forEach(obj -> obj.getRules().stream().forEach(innerObj -> {
LOG.info("Rules contain this Agenda group: {}", ((RuleImpl) innerObj).getAgendaGroup() );
}));
I've used some simplified logging as you didn't provide details of KieRuleMetaData in your snippet, but as you can see with rules defining
rule "will execute per each Measurement having ID color"
agenda-group "mygroup"
when
...
The snippet above correctly prints:
2023-02-12 10:51:45,868 [main] INFO Rules contain this Agenda group: mygroup
Then, in the test code, as you can see I'm using the agenda-group I wanted by locating it on the agenda and setting it in-focus: https://github.com/tarilabs/demo20230212-so75416633/blob/main/src/test/java/org/drools/demo/RuleTest.java#L58-L69
session.getAgenda().getAgendaGroup("mygroup").setFocus();
session.fireAllRules();
So to me I cannot reproduce any error in using agenda-groups using latest Drools available at the time of writing.
You mention you are using Spreadsheet (.xlsx) for defining the rules, and the agenda group "1" is very suspicious it might be interpreted wrongly as number Vs string.
I hope with my very first snippet above, you are able to re-instate the inspection of all the agenda-groups defined in all rules in all packages, so to verify your agenda-group "1" is really present.
If not, suggesting you try by writing in Excel as "aaa1" instead of the simple digit for one, so to make sure it is correctly saved in the Excel as a string.

Related

VS Code Regex search to remove references based on containing text in string

I am attempting to remove all references of a managed package that is going to be uninstalled that spans throughout code base in VS Code
I have using a query to find the field permissions but am wondering if there is a way to search for the reference outside of specifying the exact field name compared to the field containing only "agf" since they are all using it.
Below is the search query:
<fieldPermissions>
<editable>false</editable>
<field>User.agf_Certified_Product_Owner__c</field>
<readable>false</readable>
</fieldPermissions>
In the field, I want to be able to find and delete the 5 associated lines from multiple files if they match "agf" in any combination. Something like the below:
<fieldPermissions>
<editable>false</editable>
<field>agf</field>
<readable>false</readable>
</fieldPermissions>
With any combination of agf in the field, delete all from any file it appears in.
Not an answer but too long for a comment
You don't have to? Profiles/perm sets don't block package's delete. Probably neither do reports.
You'd use your time better by searching for all instances of agf__ (that's with double underscore), should find fields, objects... used in classes, flows, page layouts etc. And search for agf. (with dot) should find all instances where your Apex code calls their classes marked as global.
Alternatively Apex / VF pages with dependencies on package will have it listed in their "meta.xml", for example
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>54.0</apiVersion>
<packageVersions>
<majorNumber>236</majorNumber>
<minorNumber>1</minorNumber>
<namespace>SBQQ</namespace>
</packageVersions>
<status>Active</status>
</ApexClass>
Last but not least - why not just spawn a dev sandbox and attempt the delete there? If it succeeds - great. If not - it'll list the dependencies that blocked the delete. It'll be "the real thing", it'll smite you even if your VSCode project doesn't contain all flows, layouts and thus could lull you into false sense of security. I'd seriously do it in sandbox and then run all tests for good measure, just in case there are some dynamic soql queries that don't count as hard, delete-blocking references.
After delete's done - fetch Profiles / Permsets from this org and the field references will be gone from the xml.

Sparx Enterprise Architect DocumentGenerator does not honour TaggedValues on Stereotype or values from SetProjectConstants and ReplaceField

maybe someone can help me on this. I am trying to generate a document via the DocumentGenerator interface. All in all this works well, except that the DocumentGenerator does not replace the Report Constants with actual values (which are defined on the report package stereotype.
This is the general flow of the document creation code (which generally works):
var gen = Repository.CreateDocumentGenerator();
gen.SetProjectConstant("ReportName", "My Project");
gen.NewDocument(string.Empty);
gen.ReplaceField("ReportName", "My Project");
gen.InsertCoverPageDocument(tags[REPORT_COVERPAGE]);
gen.InsertBreak(DocumentBreak.breakPage);
gen.InsertTOCDocument(tags[REPORT_TOC]);
gen.InsertBreak(DocumentBreak.breakPage);
gen.DocumentPackage((int)nativeId, 0, template);
gen.SaveDocument(fileName, DocumentType.dtDOCX);
I tried ReplaceField and SetProjectConstant both and one at a time before and after calls to NewDocument/InsertCoverPageDocument:
Strangely there is one constant that is being replaced: ReportSummary.
When I run the document generator via "F8" all constants are being replaced correctly.
Other project constants are being replaced correctly.
I can reproduce the behaviour on EA v14.1.1429 and v12.0.1215.
Does someone have a hint for further troubleshooting? Thanks in advance!
========== UPDATE ==========
When I use ReplaceField at the end (before the actual call to SaveDocument the following Report Constants get replaced: {ReportTitle} and {ReportName}
I discovered some workaround: when I manually remove the predefined {Report~} constants from the template and re-add them as Project Constants, their values get replaced correctly.
I will examine this further and give an update as
I did some further investigation on this and came to the following conclusion and workaround (as I have received no comments or answers on this):
I deleted all references to ReportConstants in my EA templates and replaced them by ProjectConstants with the same name.
In my code where I want to generate the documentation I (re)set all ProjectConstants with the actual values via SetProjectConstant and additionally added a call to ReplaceField to replace the constants with the actual values.
The previous mentioned calls are inserted directly before the call to SaveDocument document.
tags.ForEach(t =>
{
if (string.IsNullOrWhiteSpace(t.Key)) return;
generator.SetProjectConstant(t.Key, t.Value);
generator.ReplaceField(t.Key, t.Value);
});
generator.SaveDocument(fileName, DocumentType.dtDOCX);
If someone comes up with a better resonse or explanation for the behaviour I am happy to accept this as answer.
I have also found that when you call ReplaceField on these project constants in a CoverPage template, the formatting defined in the template is overwritten. It seems that some of the SetProjectConstant calls actually set the values as you would expect, and the rest do not.. hence the need to call both sets of APIs.

Eclipse plugin Incubator's "Web Templates (Advanced)" plugin (with secured Redmine): Failed to parse RSS feed / invalid xml

Trying to connect some restricted Redmine instance to our Eclipse Mylyn environment it worked in the beginning, but the re-imports did not with some error "Failed to parse RSS feed".
I stumbled across this #246440 Eclipse Mylyn ticket where some workaround was to recreate the Task Repository including the Task List Queries by hand.
But this is not a nice solution.
So I played around a bit more and found the following that solved our import issues:
most likely for your needs: remove the key value (or other security-relevant data) from the exported <task list query>.xml.zip / tasklist.xml since the queries contain some user-dependent authentication API (e.g. if shared with other users)
it should anyways be configured on your related Task Repository for all dependent queries and will be re-imported automatically on later import
make sure that (e.g. through some used formatter, CTRL + F or manual formatting) there are no whitespaces in text-value XML nodes, because thus the queries may stop working after import:
e.g.
<Attribute Key="Regexp">^({Id}\d+);({Type}[^;]*);...$
</Attribute>
should be:
<Attribute Key="Regexp">^({Id}\d+);({Type}[^;]*);...$</Attribute>
go on Task List -> <your imported query> -> right click -> Properties -> Finish so some internal magic "fixes" your query
Another debugging hint: you can always check the retrieved files (and Query Pattern regexp using the Preview button) using the <your query -> Properties -> Advanced Configuration -> Open button, which should put the unparsed query result in e.g. c:\Users\<loginname>\AppData\Local\Temp\mylyn-web-connector4155864524987884464.html.
By the way: (If you are at the above point it may likely be useful for you or your team ...) Using the web connector I found the integration via the API key in combination with the .../issues.csv... format much more useful and configurable than the .../issues.xml... variant.
We used something like this for parsing the CSV (and generated the params, their order etc. via normal filter dialogs): ^({Id}\d+);({Type}[^;]*);({Status}[^;]*);"?({Owner}[^";]*)"?;({Description}[^;]*)$.
Advantages are: easier regexp, concatenatable data for Description via column-ordering and fetching of all data without paging (=> we could skip page, per_page, limit, offset).

How to produce business rule output that can be examined in the ODM Rule Execution Server Console?

I am new to ODM 8.5 (the successor to JRules), and I am trying to test some rules in the ODM Rule Execution Server Console. At this point, I'm merely trying to confirm that my rule changes have been deployed to the RES successfully. According to ODM's Testing Ruleset Execution help page, I should be able to examine the Output text box to see "strings that are written to print.out" from the web page under Explorer > RuleApps > RuleApp > Ruleset > Test Ruleset. I've deployed a rule containing the following snippet:
However, after executing the rule, I don't see the output of the println in the Output box. Is println what the documentation refers to when they say "print.out"? I get syntax errors if I try to replace "System.out.println" with "print.out". How can I get simple debug output to appear in the Output box?
The note method will cause output to go to the Output text box of the ODM Rule Execution Server Console, e.g., use:
note("*** This is the rule modification ***");
You can use the Decision warehouse(DW), in RES console.
First you need to activate the tracing in the ruleset properties.
Then after an execution, you can search in DW for execution informations such as, rule executed, data values, etc... Check online documetation details(look for ODM IBM 8.5)
Please note that this may slow down your decisions, so better not use this feature in production systems. Hope this helps.

JasperServer: Unable to locate the subreport exception

I searched for a couple of days to fix this bug with nothing new.
I had a report which include multi-level subreports everything works fine on iReport 3.7.5. I used subreport.jasper as subreport expression in the first level & also subreportA.jasper, subreportB.jasper in the second level & place all (the main report & subreports) in the same path.
The problem raised when I try to deploy it on my JasperServer.
When I try to upload the first main report the iReport wizard offerd me to attach the first subreport.jrxml in resource folder and access it with repo:subreport.jrxml or repo:subreport.jasper.
Then I manually upload the second level subreports and do the same thing change the subreport expression to repo:subreportA.jasper and repo:subreportB.jasper.
I got compilation error : Unable to locate the subreport with expression: ""repo:subreport.jasper"". java.lang.Exception: repo:subreport.jrxml not found.
I try dozen solution and nothing works.
using : SUBREPORT_DIR # the beginning,
using full path : repo:/Circuit_Reports/Connectivity/Connectivity_files/,
switch between .jasper & .jrxml.
using jasperserver_api_engine_impl_0_fix.jar in lib folder as a fixation to this bug,
I also searched the database record to be sure that they are in the same folder and have the same parent folder.
Smalltalk before Longtalk ;)
(Of course I don't want to encourage you to read everything of this long detailed post! The bold markers may already be enough to solve your problems but I found it worth documenting this tricky stuff in some more detail!)
Since I invested another couple of hours on this (after I resolved it some weeks ago, had a change now, but forgot to document it properly, forgot how I did it and could not retrieve this info again in any form - when uploading and configuring to/in JasperServer) ... here is some aggregated functionality mentioned on various sites regarding subreport referencing, how it works and what one can try ...
(I'll update mine or other findings in here if there hopefully will be some)
Short cut details / best practices?!4
Till maybe Jasper functionality provides a similar "wrapping" solution itself ...
To workaround all the problems related to running the *.jrxml, *.jasper files either locally in Preview mode or remotely on a JasperServer I am now using the following approach which allows to work with only a single *.jrxml file, that will work locally and remotely without modifications, in a multi-developer environment, supporting independent refactoring of dir structures (paths, names) per environment (= as it should ;-) ):
using some jasper-utils-*.jar
put it in your project (Java) class path (Project->Properties->Java Build Path->Libraries->Add)
put it in your ../jasperserver/WEB-INF/lib/ folder
referencing some custom Jasper Java Scriptlet jr.utl.EnvScriptlet that does the ugly subreport path/reference magic in your master reports
define the REPORT_SCRIPTLET by adding an attribute to your master report: report properties -> Report -> Data Set -> Scriptlet Class: jr.utl.EnvScriptlet
using some custom properties file jr.utl.properties or otherwise supplied system properties (any other way to set the Java system properties would be fine as well and work - where already set up properties will override loaded file properties) to configure the different environments including your
current environment information via jr.utl.env property (prod, myOsUsrName, test, demo, staging, local, ...)
which determines how the subreport references must be generated / look like
server subreport parent directory property references
take e.g. these property file contents and put one per environment here:
on your servers: ../jasperserver/WEB-INF/classes/jr.utl.properties
jr.utl.env=prod
mycompany.local.jr.gui.rep.subrep1.parentdir=repo:/x/y/z/
mycompany.local.jr.gui.rep.subrep2.parentdir=repo:/x/y/z/
mycompany.local.jr.gui.rep.subrep3.parentdir=repo:/x/y/foobar/
in your local JasperSoft Studio (Eclipse) Java src/build path: e.g. ../myrepproject/src/java/jr.utl.properties
jr.utl.env=dietrian
mycompany.local.jr.gui.rep.subrep1.parentdir=D:/reporting/src/reports/
mycompany.local.jr.gui.rep.subrep2.parentdir=D:/reporting/src/reports/
mycompany.local.jr.gui.rep.subrep3.parentdir=D:/reporting/src/reports.otherdir/
to achive source modification independency in our environments we parameterized those values and generate them once via some workspace-dependent/user-specific local.properties file, based on this idea:
|- build.xml (containing the ANT build magic)
|- build.properties (containing global properties)
|- local.properties (ignored in version control, e.g. .hgignore, user-specific generated from local.template.properties)
|- local.template.properties (source for ANT build task generating the local.properties above)
|- mycomp.local.proj.reporting.dir=D:/reporting
|- src/reports
|- jr.utl.properties (ignored in version control, user-specificly generated based on template below)
|- jr.utl.template.properties (source for ANT build task generating the jr.utl.properties above)
jr.utl.env=${user.name}
mycompany.local.jr.gui.rep.subrep1.parentdir=${mycomp.local.proj.reporting.dir}/src/reports/
mycompany.local.jr.gui.rep.subrep2.parentdir=${mycompany.local.jr.gui.rep.subrep1.parentdir}
mycompany.local.jr.gui.rep.subrep3.parentdir=${mycomp.local.proj.reporting.dir}/src/reports.otherdir/
defining your BASE_DIR master report parameters as e.g.
$P{REPORT_SCRIPTLET}.getProp("mycompany.allsubreports.parentdir") (matching some environment-dependent property in your jr.utl.properties file)
defining the master subreport expressions as e.g. jr.utl.EnvScriptlet.getSubrepPath( $P{BASE_DIR}, "subrep1.jrxml")
automatically resolving the values from properties you could also use e.g. these variants:
jr.utl.EnvScriptlet.getSubrepPathByPropKey( $P{BASE_DIR}, "mycompany.local.jr.gui.rep.subrep1.name")
jr.utl.EnvScriptlet.getSubrepPathByPropKeys( "mycompany.local.jr.gui.rep.subrep1.parentdir", "mycompany.local.jr.gui.rep.subrep1.name")
$P{REPORT_SCRIPTLET}.getSubrepPath(...) does not work here :-( (I don't know why)
do not forget to restart your server when you put all the files on the server!
(4: Of course I am still seeing some minor improvements here, but it seems much better than all the ugly solutions I found till now. Improvements I would see:
using the REPORT_SCRIPTLET or scriptlet functionality may not be the best way to go, but it will probably work in the vast majority of use cases
although both existing Jasper classes suggest this they do not seem to be able to handle the above properly:
FileResolver
RepositoryUtil
)
(5: the relevant special handling is encoded here: EnvScriptlet.java/getSubrepPath(String,String,boolean,String[]))
Intro (Background)
First thing to know is that the handling/setup in JasperStudio is quite different from the handling on Jasper Server (Repository)5 ...
suppose we have the following enviroments:
our Eclipse install dir: C:\eclipse\
our Eclipse (Report) workspace: C:\workspace\
our report project under: C:\workspace\report-project\
our reports under: C:\workspace\report-project\src/reports
a master report C:\workspace\report-project\src/reports/masterrep.jrxml
some subreport C:\workspace\report-project\src/reports/subrep1.jrxml
another subreport C:\workspace\report-project\src/reports/somesubdir/subrep2.jrxml
the BASE_DIR (explained in next section) in our workspace master report is set to C:\workspace\report-project\src/reports/
our Jasper Report Server GUI repo id-path of our master report will be: /x/y/z/
(which is not to-be-confused with the visual named-path, e.g. which could be Financial Reports/Expenses/Current Year)
In general: Jasper Studio, JasperServer
(and other "Jasper runtime environments" like custom Java Jasper package usage):
it seems a good practice to declare a report parameter "prefix" which can vary depending on your Jasper runtime environment e.g. named BASE_DIR
important here is that it seems best to assume the suffixed / may be included1 because there are cases where you may have/want to use it in a way where it should be an empty or "unslashed" path expression
e.g. $P{BASE_DIR} + "subrep1.jrxml" which should resolve to
repo:subrep1.jrxml
see e.g. here for more details (look for SUBREPORT_DIR)
(1: which I personally find a bad practice in general (not looking at Jasper Reports in this respect) when dealing with directory-like structures)
JasperStudio Designer (Eclipse Plugin)
(the official IReport successor with loads of more functionality)
(if you do not use the preview functionality this may be uninteresting to you)
unfortunately I found no practical way to fully support (normal) "team-development" with subreports (and likely other relative resources as well), meaning here the (currently to me unknown) inexistent possiblity to separate local paths and *.jrxml files :-(
e.g. if you have a version control system in place and work in different environments (different local paths to repos and/or different developers) the master report has to contain a local path to your subreport in some way)
I tried different approaches that failed:
relative path expressions in BASE_DIR do not work since the working directory is the eclipse dir, e.g. C:\eclipse
Eclipse->Window->Preferences->JasperStudio->Properties->Add e.g. my.base.dir
it is not available in the Preview mode, e.g. via new java.io.File(System.getProperty("my.base.dir")).getCanonicalPath() + "/" for our BASE_DIR expression (these props may be only used by the designer itself, but not set in preview runs)
just in case you may stumble upon (as I did): Eclipse->Window->Preferences->JasperStudio->Report Execution->Virtualizer Temporary Path is something unrelated (not useful here) dealing with the storage of the report result "caching"
of course I could write an ANT task to replace these local pattern based on a regexp filter copy on every usage/checkout, but that seems not a good way to handle this
if you solely want to work with *.jrxml files (as I do3) you have to reference some subrep1.jrxml like this: net.sf.jasperreports.engine.JasperCompileManager.compileReport($P{BASE_DIR} + "subrep1.jrxml")
(3: I don't need the *.jasper files explicitely and do not see why I want to deal with them. BTW the JasperServer WebGUI only seems to support the upload of *.jrxml files)
JasperServer Web GUI
(e.g. provided by some Tomcat application server and storing its data in some postgres database)
Scenario 1: reference attached subreport resource(s)
if you do not want to reuse your report in general, it seems fine to add your supreport to your master report (so it is not visible in the GUI repo tree - see below subitem how you could reference it outside of your master anyways)
if you attach your subreport it should in general have its file name as its resource id, e.g. our subrep1.jrxml from above is uploaded with a resource id of subrep1.jrxml (thus making the handling of local design references and server references less complicated)
taking the example reports from above we have to set our BASE_DIR to repo: in the to-be-uploaded master report
thus the subreport expressions $P{BASE_DIR} + "subrep1.jrxml" and $P{BASE_DIR} + "somesubdir/subrep2.jrxml" should work on the server as well
NOT recommended!: you could still reference these reports from other reports with absolute paths like this2: repo:/x/y/z/masterrep.jrxml_files/masterrep.jrxml_
(2: which I would not recommend in this case; it's undocumented and may change; better put your subreports then into the "GUI repo path" as described below)
Scenario 2: reference repo subreport resource(s)
suppose we upload our subreports to the master repo id-path /x/y/z/ (as shown on top)
again we have to differentiate two different use cases
we do NOT want to use the subreport as a standalone report (it will always only be included in other master reports)
in this case we should upload it using Add Resource->File->JRXML and reference it
../subrep1.jrxml or ./subrep1.jrxml do not work since it seems the underlying logic cannot handle the relative path expression .. (and likely . not as well) (which would actually be nice :-( )
so what we have to do here is to supply an absolute canonical path in the BASE_DIR of our masterrep.jrxml, e.g. repo:/x/y/z/
we want to use the subreport as a standalone report as well
in this case we should upload it using Add Resource->JasperReport
this obviously creates a hidden folder repo:/x/y/z/subrep1.jrxml_files containing the report itself and other resources
that's why we not only have to adjust the BASE_DIR (as above), but also the subreport expression to, e.g. $P{BASE_DIR} + "subrep1.jrxml_files/subrep1.jrxml_" (which points to the subreport itself)
and maybe remove the net.sf.jasperreports.engine.JasperCompileManager.compileReport(...) wrapper function, because the server does this automatically for *.jrxml files
I did not fully investigate some other likely incorrectly used approaches which did not work for me to solve the mentioned problems (maybe somebody else has some outcome/corrections here):
$P{REPORT_FILE_RESOLVER}.resolveFile("subrep1.jrxml") (NullPointerException)
resulting in empty subreport sections in master report:
$P{REPORT_CONTEXT}.getRealPath("subrep1.jrxml")
$P{REPORT_CONTEXT}.getProperty("REPORT_FILE_RESOLVER").resolveFile("subrep1.jrxml")
Additional hints
Since I like to automate the report design and deployment process as much as it makes sense I wrote some ANT tasks that handle the local *.jrxml file to deployable *.jrxml file transformations regarding the BASE_DIR and the other transformations.
SQL helpful to easily investigate the resource id path structures in a jasper server postgres meta database (following something like jdbc:postgresql://myjasperhost/jasperserver connecting e.g. with the postgres user):
select
f.id as folder_id,
r.id as res_id,
case when f.hidden = true then 1 else 0 end as hidden,
f.uri||case when f.uri = '/' then '' else '/' end||coalesce(r.name,'') as res_uri,
r.resourcetype,
r.creation_date,
r.update_date,
f.uri,
r.name,
-- less important
r.version,
r.parent_folder,
r.childrenfolder,
f.parent_folder,
f.version,
f.name
-- select *
from jiresourcefolder f
left outer join jiresource r on (r.parent_folder = f.id)
where not f.uri like '/themes%'
order by f.uri||coalesce(r.name,'')
Related Questions
Questions on the Jaspersoft forum related to this one include:
http://community.jaspersoft.com/questions/525466/proper-way-include-subreports
http://community.jaspersoft.com/questions/530526/subreport-could-not-load-object-location
http://community.jaspersoft.com/questions/517832/subreports-ireports
http://community.jaspersoft.com/questions/537611/sub-report-jrxml-jasper
http://community.jaspersoft.com/questions/534861/unable-compile-master-report-pls-advise
http://community.jaspersoft.com/questions/817852/databasetimezone
http://community.jaspersoft.com/questions/819343/comjaspersoftjasperserverapijsexception-error-filling-report-and
http://community.jaspersoft.com/questions/536251/solved-subreport-not-running-jasperserver
http://community.jaspersoft.com/questions/536218/resolved-problem-subreport-reference-after-exporting-ireport-jasperserver#81141
http://community.jaspersoft.com/questions/527109/subreport-problem
http://community.jaspersoft.com/questions/522331/atomatically-compile-subreports
Not sure if this mechanism works in all cases but it certainly works for JasperSoft Studio 5.6.0 and Jasper Reports Server 5.6.0.
Essentially we need a simple way to detect that we are running on the server - I use the presence (or absence) of the $P{REPORT_CONTEXT} parameter which experiments show is present on the server but not present during preview.
<parameter name="OnServer" class="java.lang.Boolean" isForPrompting="false">
<parameterDescription><![CDATA[Are we running on server]]></parameterDescription>
<defaultValueExpression><![CDATA[Boolean.valueOf($P{REPORT_CONTEXT}!=null)]]></defaultValueExpression>
</parameter>
Once you have that you can then define the location of your subreport from a choice of two:
<parameter name="SubReportProducts" class="java.lang.String" isForPrompting="false">
<parameterDescription><![CDATA[The products subreport]]></parameterDescription>
<defaultValueExpression><![CDATA[$P{OnServer}.booleanValue() ? "repo:OrderPicksheetProducts.jrxml" : "OrderPicksheetProducts.jasper"]]></defaultValueExpression>
</parameter>
And then include the sub report:
<subreportExpression><![CDATA[$P{SubReportProducts}]]></subreportExpression>
You can then use Preview in studio and all still works when you deploy to server.
I'm not 100% of this answer but : You have to upload your subreport as a jrxml ressource and put "repo://subreport.jrxml" to get it work.
If you read this one of those days tell me if it worked or what solutions you found.
Regards
Try removing the extension completely and use "repo:/subreportFolder/subreportName". The main report pulls the jasper file in iReport, but on the jasperserver you upload the jrxml.