SID-01586: How to search and format result like a pivot table ?
| Status: |
Answered |
TWiki version: |
5.1.1 |
Perl version: |
|
| Category: |
CategorySearch |
Server OS: |
linux |
Last update: |
13 years ago |
Hello,
I have this search:
%SEARCH{ "\bCategoryTimeSheet\b;\b%INCLUDINGTOPIC%\b;META:FIELD.name=\"[T]imesheetType.*value.*[E]mployee"
regex="on"
nonoise="on"
excludetopic="*Header,*Template,%INCLUDINGTOPIC%"
format="|$formfield(Belongs to)| $percntCALC{$EVAL($percntIF{ \" '$formfield(Entry1 workorder)'='%INCLUDINGTOPIC%'\" then=\"$percntIF{ \" '$formfield(Billable1)'='Yes'\" then=\"$formfield(Entry1 hour)\" else=\"0\" }$percnt\" else=\"0\" }$percnt)|}$percnt
"}%
result:
| name |
hour |
| Robert Var |
3 |
| Jane Doe |
5 |
| Jane Doe |
6 |
| Kirk Parser |
13 |
goal result with out using
Plugins.FluidPivotsPlugin :
| name |
hour |
| Robert Var |
3 |
| Jane Doe |
11 |
| Kirk Parser |
13 |
I tried,
%CALC{$LISTJOIN($n, $LISTMAP(|$item|, $LISTUNIQUE($LISTSORT($GET(names)))))}%
but i couldn't match the names with its corresponding hour. I also try to pull data from tables (but dont know how)
Any suggestion for suitable search or a accurate
TWiki.RegularExpression that can pull data.
Thanks
--
MichaelSevero - 2012-11-16
Discussion and Answer
My work around:
a. Did my search
b. Use
FluidPivotsPlugin, to narrow down result (remove duplicates and sum hours to its corresponding name)
c. Use
SpreadsheetPlugin to pull data from the
FluidPivot table.
d. Set the pulled data to a javascript variable
e. Use the javascript variable to set the manipulated view.
This works for me for now
--
MichaelSevero - 2012-11-17
Michael, it looks like you are doing some advanced stuff with TWiki. You could write a blog on TWiki.org describing the challenges you have and how you solve them using TWiki. More at
Blog web.
In regards to pivot table, you can use CALCULATE variables to store data temporarily, then use some spreadsheet magic to pivot the data. For inspiration study the source of the
TWikiVariablesWizard
on develop.twiki.org.
--
PeterThoeny - 2012-11-17
I will once I deploy it. Right now, I'm building and testing apps.
--
MichaelSevero - 2012-11-22
If you answer a question - or someone answered one of your questions - please remember to edit the page and set the status to answered. The status selector is below the edit box.