I have table placed inside repeat control and I need to construct the <xp:td> tag with rowspan and colspan attributes, where the attribute value changes dynamically. I am not able to find a solution, could you suggest me the best possible solution. Here is my scenario -
Basically I need to show a table quarterly wise where the row span changes, based on selection of start date and end date. for e.g.
Start Date : 1-Feb-2013 and End Date : 30-Dec-2013
-
In "All Properties" of a <xp:td> you find rowspan and colspan. Both attributes can be computed. I suggest you compute that in a function you call with some parameter th be handed over. You might need a requestScope or viewScope object to keep track of your row/col span usage. use JSON for it, makes things easier.
Hth
Related
I'm not able to take the means for a large dataset given that the amount of attributes is irregular.
I have posted a simplified case for the problem. It explains the problem very well.
An idea that I came up with: Make a filter to condition on a single attribute. However, still, I don't see a way to do this in an efficient way (other then doing it all by hand).
see excel file:
All help is much appreciated.
I'm basically looking for a function/method to achieve taking means of all different attributes conditioned on each person for a large dataset without doing it by hand.
You can use AVERAGEIFS() inside an IF:
=IF(OR(A2<>A1,B2<>B1),AVERAGEIFS(C:C,A:A,A2,B:B,B2),"")
the ifrst part of the if tests whether the row starts a new group either by the person or the attribute changing. Then it uses AVERAGEIFS() to return the correct average of that group. otherwise it returns a blank
What you want to do can be accomplished very simply with a pivot table.
Simply select one of the cells inside the range of data you want to process(See the video for general use of a pivot table https://www.youtube.com/watch?v=iCiayB6GrpQ )
go the insert tab and insert pivot table.
Once you have it, simply check people, attribute, and values. Then drag people and attribute into rows, drag valut into the values window, select the drop down list and change it from sum of value to average and you should be done. https://i.stack.imgur.com/nYEzw.png
I'm working with Microsoft Dynamics AX R3,2012 and i want to add a group by field in an dynamics:AxGridView then a sum for a certain field by the group field indicated then the total sum without the group by .Please help me .i didn't find a solution.like what described in this page http://www.agrinei.com/gridviewhelper/gridviewhelper_en.htm
You can create a display method to compute your sum on each row. If you do so, don't forget the 'cacheAddMethod' in order not to compute it each time. This is the "historical" way.
More info on display methods.
Or you can create a view and use computed column in it. It will depends on your current datamodel and query you want to run.
More info on computed column in views.
Thanks for your reply,My Problem is not to create display method but the Problem is how to display the sum of subtotal by this display field.So my solution is to add GroupField in the AxGridView with designed field like GoalId in my case.then in the AxGridView i create template field with footer containing label not visible in default. So in rowdatabound i do the total by the new group that known with a test in rowcreated in GoalId 's value changes .Then when i get a new group i put the value of cumul of the previous value of a the previous group and in the footer template i display the total of all rows.this is the solution and thanks so much for your help. but now the problem that i noticed that axgridview have problems after updating data with a groupby fields and with template field.it display noting in this fields
I have : <xp:repeat id="repeatColor" value="#{productcolors}"
var="rowData" indexVar="rownum" >
PROBLEM : rownum goes from 0 to the last correct value, but rowData is always the same
This repeat control is bound to a view "productcolors" , a view with a key on product code.
This view has a first column with the product code , ascending (for the key).
It also has a second and a third column with ascending multiple value fields.(second is framecolor, third is upholstery color)
The idea is that the repeat control goes through the different colors for the selected product, but it only shows the first one and does that the number of times (rownum increases correctly)that there are colors for the selected product.
EDIT :
So I have for example a product called "A" available in framecolors "1" "2" and "3"
When I am using the repeat control rownum changes from 0 to 2 but rowData is always the reference of framecolor "1". I don't know why rowData isn't changing.
When I use rowData.getUniversalID() I am getting 3 times the ID of the document containing the multiple value field with the 1 , 2 and 3 in it, which is I guess normal ? But how can I get a handle to those different values inside it ?
SECOND EDIT
I tried :
var testje:string = rowData.getUniversalID();
var db:NotesDatabase = session.getDatabase(database.getServer(),"product/colors.nsf");
var doc:NotesDocument = db.getDocumentByUNID(testje);
test = doc.getItemValueString("colorUpholstery");
The result is that "test" only holds the first item of the multiple value field "colorUpholstery" .
How is that possible ? I thought I would get the complete value of the "colorUpholstery" field ?
Maybe because I only have reader access(Publicaccess) to the colors.nsf database ?
It would be nice to see a little more code... like what's inside the repeat.. just to get a better feel for it to go along with your description of the Notes View.
rowData should be an XSPViewEntry... basically a NotesViewEntry... I suggest you first do something like rowData.getDocument().getUniversalId() to make sure it is iterating the documents correctly. I'm sure it is.
It sounds like you're trying to do something with a multi-value field.. are you also setting the view to use display multiple values as row entries? or whatever that setting is? That might get dicey if that's turned on. Not sure.
Again I'm not totally following what what the goal is but I would first test to make sure it is actually repeating the expected documents. then it's all about fine tuning.
EDIT: Ok... some thoughts based on your additional info:
I suspect that your problem is the use of the view setting "show multiple values as separate entries". Each is the same document really. So that's likely not helping you here. I'm still a little fuzzy on exactly what you want for the output. Is this from a "view page" of maybe products? a "form page" of a single product?
I ASSUME you want all the colors for a single product? And this is a lookup view right? so you're on your product "document" and now you want to list all the colors?
Assuming so...
Use SSJS and the object model. Do a lookup to find the SINGLE document that has the multi-value color field for your current product. then return to a repeat control something like:
lookupDoc.getItemValue("colorField")
I'm not 100% sure that's the correct syntax. The point is you can send a multi-value field to a repeat control and it will repeat it. Much easier then trying to use view tricks.
If your goal is to have a Repeat of multiple products.. and in side each "row" to show all the available colors then you're looking to have a nested repeat really... The outer repeat (outerData) to iterate over all the main products and inside that another repeat (innerData) for the colors. Inside that repeat code you use the "outerData" to get the multi-value field. Something like:
outerData.getDocument().getItemValue("colorField")
Assuming I'm understanding you correctly these are my suggestions.
I did do an example of nested repeats like this on an early NotesIn9. I believe it was this one: http://notesin9.com/index.php/2010/03/30/notes-in-9-show-14-repeats-repeated/
Maybe that will help.
Second Edit Response:
Based on the code you added you're using "doc.getItemValueString()" By design that will only get you the first value of a multi-value field. This is the same as saying in LotusScript:
doc.colorUpholstery(0)
or the less commonly used
doc.getItemValue("colorUpholstery")(0) ' I might have that wrong. I never really used it
Again if you want to make a list of all the colors I'd use a repeatControl and pass in:
doc.getItemValue("colorUpholstery") then your "rowData" for that repeat will be each value. I've seen others avoid the repeat and doing some javascript explode or implode type thing I believe. using "\N" or something as a separator for a new line. I just use a repeat. Easer for me to understand.
Again I THINK everything you need really is in NotesIn9 episode 14.
I am having a major problem even getting started with finding an answer to this question? I have a UITableView that is being populated by user generated content and being persisted to CoreData. All is good. However I can't even find a way in the Apple docs to do the following:
How do I add each dollar value in a cell to get a grand total displayed somewhere to the user? In this case it can be thrown in a UILabel in the footer of each section I don't care. What I can't figure out is how to get to each individual cell get the dollar amount entered there and add it to the next dollar amount in the next cell in the section and so on.
Any ideas on how to add totals from cells to get a grand total?
The most elegant solution to this problem is using key paths.
You do not go to the cells and get the data out. You go to your data model and calculate it from there. Remember, MVC dictates that you should always separate model and view.
Suppose you have a subclass of NSManagedObject with an NSNumber attribute "amount" fetched via core data. You can then easily do simple calculations like this:
float sum = [[fetchedObjects valueForKeyPath:#"#sum.amount"] floatValue];
This is described in the Key-Value Coding Programming Guide under Collection Operators.
I was reading the following link, which provides an introduction to composite columns and I had few doubts, specially regarding the usage of ComponentEquality.EQUAL and ComponentEquality.GREATER_THAN_EQUAL.
In the following example:
Composite start = compositeFrom(startArg, Composite.ComponentEquality.EQUAL);
Composite end = compositeFrom(startArg, Composite.ComponentEquality.GREATER_THAN_EQUAL);
start.addComponent(1,"CA",Composite.ComponentEquality.EQUAL);
end.addComponent(1,"CA",Composite.ComponentEquality.GREATER_THAN_EQUAL);
I'm unable to comprehend why the end component needs GREATER_THAN_EQUAL as equality component.
An explanation with example would be really helpful
The way a slice query works in cassandra is that you specify a start column and an end column(limit/isDescending flag too but that is irrelevant here). One way of querying for your use case would be to pass the complete (Composite)column name for the first composite column that starts with US:CA and the last composite column that starts with US:CA. However, you do not know this in advance.
The good thing about slice queries is that the start and end columns do not need to be actual column names. Since column names are always sorted, if the start column in the slice query does not exist, cassandra will start from the next column greater than the start column provided.
So, we need to construct a start column and an end column for your query. As described in the link, a composite object has an e-o-c bit. This bit is used by slice queries.
A composite column has several components. Each component has the e-o-c bit. When a component has this bit set to Equal, Cassandra moves on to look at the next component. When a component has this bit set to GREATER_THAN_EQUAL, Cassandra will keep on looking at columns, until it finds something whose respective component is not equal to the component we are looking for.
So, now consider the example in the link: We want to do a slice query on a column family which has a composite comparator with three components. We want to get all columns where the first component is US and the second component equal to CA.
We have to create a start column and an end column. The start column will have two components(both with EQUAL as e-o-c) and the end column will have first component as EQUAL and the second component as GREATER_THAN_EQUAL. This will match all the columns whose first component is US and second component is CA.
If you set this bit to EQUAL, a slice query will match the first column it finds with start component is equal to 'CA'. This is fine but Cassandra also needs to know the end column for the slice query. For this, it will look at the end composite you provided.
Hope this helped.
EDIT: To make explanation better