how to display multivalued fields in velocity - velocity

I want to display a multivalued field in velocity.
The field is extracted from the oracle database.
My problem is that it does not display the values per line. Rather it just wraps the rows one after the other instead of creating a new line for a new row.
The follow code is what I used:
<div>#field('BugDescription')</div>
how do I break it down, so it's more readable?

Use the #foreach directive to loop through the values of a collection.

Related

Update custom fields in an VBAP append structure via VA02

I have the following requirement. I need to save some parameters in the table VBAP. I've created additional fields in an append structure for that. Now, when a sales document is being saved, the parameters have to be updated as well.
For this I've been using USEREXIT_SAVE_DOCUMENT in the program SAPMV45A. There I loop over the table XVBAP where I set the fields.
This works as expected for existing positions. When a new position is being added the fields won't be updated and are empty.
What am I missing here? Do I have to use a different user exit for new positions?
Thanks in advance.
you can use "USEREXIT_MOVE_FIELD_TO_VBAP" in MV45AFZZ

OpenRefine - Fill between cells but not at the end of the list

I have a list of stock prices for several stocks. Some of the values are missing due to weekends, holidays and probably other reasons.
The gaps are not consistent. Some are two days and some are more than that.
I want to fill the gaps with the last known value but not at the end of the list.
I have tried in Excel to test a few cells below and if it's now empty, do the fill. The problem is that due to the inconsistency of the gaps, it's a tedious task to change the function for all the cases.
Is there a way to test for the end of a list?
UPDATE - added a screenshot.
See this screenshot. I want to fill where the blue dots are. The red dots are at the end of the list and I don't want to fill those cells.
I am looking for a way to detect the end of the list and stop the filling when the end is detected.
I think this is pretty difficult in OpenRefine and probably a different tool would work better. The main issue is that OpenRefine does not offer the ability to easily work across rows so 'summing a column' (or part of a column) is tricky - this is mentioned in https://github.com/OpenRefine/OpenRefine/issues/200
However, you can do this by forcing OpenRefine in Record mode with the whole project containing a single record. Once you've done this you can access all values in a column using syntax like:
row.record.cells["Column name"].value
This gives an array of all the non-blank values in the column. Since this ignores blank values, in order to have a true view of the values in the column you have to fill in blank cells with a value.
So I think you could probably achieve what you want as follows:
For each column you are going to work with do a cell transform to put a dummy value in empty cells - e.g. if(isBlank(value),"null",value)
Create a new column at the start of your project and put a single value in the very first cell in that column
Switch to Record mode
At this point you should have a single 'Record' in your project - e.g.
You can now access all cells in a column using syntax like row.record.cells["Column 1"].value. You can combine this with 'forRange' to iterate through the contents of this array, using the row.index as the marker for the current row.
I used the following formula to add a new column to the project:
with(row.record.cells["Column 1"].value,w,if(forRange(row.index,w.length(),1,i,w[i].toNumber()).sum()>0,"a","b"))
Then...
Change back to 'Row' mode
Remove the 'null' placeholder from the original column
Create a facet on the 'fill filter' column
In my case I filter to 'a'
Use the 'fill down' option
Remove the filter
And remove the 'record' column
Rather a long winded way of doing it to say the least, but so far I've not been able to find anything better while not going outside OpenRefine. I'm guessing you could probably compress steps 5-11 into a single step or smaller number of steps.
If you want to access the array of cell values using Jython as suggested by iMitwe you need to use:
row["record"]["cells"]["Column 1"]["value"]
instead of
row.record.cells["Column 1"].value
(step 5)
I am doing this on the top of my head, but I think your best chance my be using the fill down option in record mode:
first move your column to the first column and switch to record mode.
then use the following GREL: row.record.cells["data"].value[-1] where data is the name of your column
The [-1] will take the last value and fill the blank. For the case with the red dot, since there is no value it should remains empty. Let us know how it goes.
Unless there's something I am missing or not seeing...
I would have just sorted reverse (date ascending) on the Date column, then individually use Fill Down on each column, except for that last column where you could then use a Date facet on your column Date to specify the exact Date range you wanted to work with, then fill down on that last column, then remove the Date range facet.

Best way to handle multi-valued fields as a view/grid

In several notes applications, instead of handling related data as separate documents, if the size of the data is small (less than the 32k limit), I'll make several multi valued fields and display it in what I call a "List Panel". It's a table where each column displays one multi-value field. Since fielda(1) goes with fieldb(1) that goes with fieldc(1) there is a concept of rows. (I did a similar thing in my auditing routine discussed here )
It is always assumed that each field has exactly the same number of elements.
All the multi-value fields are then stored on the single document. This avoids several coding conventions that made my eyes bleed like having date changed, who changed it, new value fields for each field we wanted to audit. Another thing that this kept to a minimum was having to provide multiple fields for the same thing that locked you into a limit. Taxrate1, Taxrate2, Taxrate3, etc...
In my "Listpanel" the first column is a vertical checkbox. (One for each element in my lists) This is so I can select one item to bring up and edit, or select multiple values to delete "rows" or apply some kind of mass change to them.
What would be the best way to handle this under xPages to get this functionality? I tried making a table but am having the devil of a time to get the checkboxes to line up with their corresponding data items.
Views and dojo-grids seem to assume we're using a document for each row.....
This TableWalker may provide what you want http://www-10.lotus.com/ldd/ddwiki.nsf/dx/Tutorial-Introduction-to-XPages-Exercise-23
It was created when XPages was all very new, so it's SSJS rather than Java. But if you're comfortable wiith Java, converting it probably won't be a challenge.
You could use a repeat control to display the values and build a table using the table row tags in the repeat. You would want to calculate the id of the checkbox to be able to take an action on that selected row. The repeat var would be just one of your multi-value fields and you use the index of the repeat to get the value for that row from the other multi-value fields.

Choosing id one by one from a variable in jmeter

I want to delete mappings in DB using DataService.
For this purpose
I run search query for all ids in first thread group.
Using this method I put my Ids into the property.
Now property has view like that b69243ee6e9efdf66114200dc93881ac,b69243ee6e9efdf66114200dc90f5ba4,b69243ee6e9efdf66114200dc90e2184
I want to all delete mapping using this Ids from property one by one.
For this purpose I need run BeanShell Pre-Processor and choose first id and put it into variable. Please, help me with this script.
I believe ForEach Controller is the solution. But in my experience, I use regular expression extractor to grab the values and put it in one variable then loop it using ForEach Controller. I think these step will help you:
Add Regular Expression Extractor to grab the ids.
Make sure you fill field "Match No" with negative number (i.e. -1). Put the extracted value into one variable (i.e. IdVar. Fill Reference Name with IdVar). This step will grab all matched ids and put it into IdVar variable.
Then Add ForEach Controller to process each ids from IdVar variable.
For the details, just download this sample and try to run it.
I hope this will help you. :-)

Print When (last element reached) Expression in JasperReports

Is it possible to generated a "Print When Expression" that detects the last element in an XML datasource file?
Basically I have a report with a column break inserted after a sub-report in a detail band so I can clearly define new pages for the beginning of a new record. But it always leaves me with a blank last page. So I am hoping that I can prevent this if I have a print when condition that prevents the column break if it is the last record element in the XML datasource.
Is this even possible?
The problem is that you don't know it's the last element until after you look for the next element. I don't think there is a simple way.
In principle it should be fine to do something like this:
Create a super-report around the entire report. Run the same query in the super-report. Count the rows. Then pass the number of rows to the original report (which is now a subreport) and re-run the query again. Clearly, running the query twice is another drawback.
If the data source were SQL, then I would suggest modifying the SQL to return the number of rows as part of the result set. But for non-SQL data sources, you need some way of knowing the number of rows (well... some way of identifying the last row) before you reach the last row.
Many years late...
if you sure your datasource is a JRBeanCollectionDataSource, you could use:
$V{REPORT_COUNT} == ((net.sf.jasperreports.engine.data.JRBeanCollectionDataSource)ORIGINAL_DATA_SOURCE( )).getData().size()