how to get category value from xml params? - joomla

I have the following field in xml:
<field
name="cat1"
type="category"
extension="COM_CONTENT"
label="MOD_ITEM_CAT1"
description="MOD_ITEM_CAT_DESC" />
Now, I wanted to get selected value:
echo $params->get('cat1');
Which shows me 8 (the value of selected option) not it's title.
I've category title people and it should show people instead of 8.
So, how to extract the title of the category?

However, I solved the problem by changing the type category to sql:
<field
name="cat1"
type="sql"
query="SELECT title AS value, title FROM #__categories"
label="MOD_ITEM_CAT1"
description="MOD_ITEM_CAT_DESC" />
And this outputs category title people.
echo $params->get('cat1'); //outputs people

Related

Apex Item in interactive report not being displayed correctly

I'm creating a interactive report and I want to dynamically create apex items (text fields) in it, but they are not being displayed correctly.
This is my code:
select
APEX_ITEM.text( p_idx=> 1 , p_value=> null, p_item_id => 'dynamic_item') as "Textfield"
from dual
connect by level = 3;
This shows up in the report:
<input type="text" name="f01" size="20" maxlength="2000" value="" id="dynamic_item" />
But I would like to get the actual item and not the code?
What am I doing wrong?
It looks like you didn't set the escape special characters property to "No".
Go on your report and select the column you created (Textfield).
Then on the right at "Security - Escape special characters" select "No".
Now it should be displayed correctly!

How to remove an element from a many2many field?

I'm trying to remove a group element from the many2many list in the model res.groups. In particular I'm trying to remove the "Analytic Accounting" group from the Employee (implied_ids field):
<record model="res.groups" id="base.group_user">
<field name="implied_ids" eval="[(3, ref('analytic.group_analytic_accounting'))]"/>
</record>
I use the number three because I read it in this question:
(3, ID) => cut the link to the linked record with id = ID
(delete the relationship between the two objects but does not delete the target object itself)
But the element doesn't dissapear from the list. Do I need to do anything else? Am I doing it in a wrong way?

How to store in Pentaho User Console Analysis Month number value instead Month name value

Is possible somehow store column number instead column name in filter of saved analysis? My version of Pentaho User Console is 5.3. This is my level element in mondrian for month:
Stored values in database:
Values in month_name are: [Jan, Feb, Mar, Apr,...]
Values in month_number are: [1,2,3,..]
<Level name="month" visible="true" column="month_number" ordinalColumn="month_number" nameColumn="month_name" type="String" uniqueMembers="false" levelType="TimeMonths" hideMemberIf="Never" caption="%{polymis.dimension.timedimension.hierarchy.level.month.caption}">
<Annotations>
<Annotation name="AnalyzerDateFormat">
<![CDATA[[yyyy].['Q'q].[MMM]]]>
</Annotation>
</Annotations>
</Level>
Above you can see that i use column="month_number" so i thought that the value that will be stored in analysis file below like filtered value, but instead there is the value from "month_name", for me this is invalid because i use localized values of months, so when i turned my language into another one this will not work for me in Pentaho user console.
The stored value should be rather
<filters>
<filter formula="[timedimension].[month_name]" viewFilterEnum="MULTIPLE">
<predicates>
<predicate ordinal="1" operatorEnum="EQUAL">
<member formula="[timedimension].[2010].[Q1].[Mar]" caption="Mar" pos="0"/>
</predicate>
</predicates>
</filter>
</filters>
The result should be like below or something like that
<member formula="[timedimension].[2010].[Q1].[3]" caption="Mar"
pos="0"/>
You have an attribute
nameColumn="month_name"
You should be using month_number for the name attribute. As it's the same as the column attribute, you can simply delete it.
The AnalyzerDateFormat annotation also needs changing, from [yyyy].['Q'q].[MMM] to [yyyy].['Q'q].[M].

Using FetchXML in CRM 2011

I am using FetchXML and I am grouping and using count for two of the entities but the rest of the entities I don't need grouped I just need the data to be pulled down. For example this is my code:
string groupby1 = #"
<fetch distinct='false' mapping='logical' aggregate='true'>
<entity name='opportunity'>
<attribute name='name' alias='opportunity_count' aggregate='countcolumn' />
<attribute name='ownerid' alias='ownerid' groupby='true' />
<attribute name='createdon' alias='createdon' />
<attribute name='customerid' alias='customerid' />
</entity>
</fetch>";
EntityCollection groupby1_result = orgProxy.RetrieveMultiple(new FetchExpression(groupby1));
foreach (var c in groupby1_result.Entities)
{
Int32 count = (Int32)((AliasedValue)c["opportunity_count"]).Value;
string OwnerID = ((EntityReference)((AliasedValue)c["ownerid"]).Value).Name;
DateTime dtCreatedOn = ((DateTime)((AliasedValue)c["createdon"]).Value);
string CustomerName = ((EntityReference)((AliasedValue)c["customerid"]).Value).Name;
}
But I get this error:
EXCEPTION: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: An attribute can not be requested when an aggregate operation has been specified and its neither groupby nor aggregate. NodeXml : (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault).
How do you use aggregates on some values and not others?
The error message is giving you the answer - this isn't possible with FetchXML. You'll need to make two FetchXML calls; one for your aggregates and one for your data.
So, there are a few things going on here. The problem isn't so much that your query is not achievable with FetchXML as it is it's not achievable in any query language, including SQL. The SQL of your FetchXML above is as follows:
SELECT ownerID, createdon, customerid
FROM dbo.Opportunity
GROUP BY ownerID
If you try to run this SQL against your database, you'd get the standard Column 'dbo.Opportunity.CreatedOn' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. error, which is exactly what your exception is trying to tell you. To solve this, you need to also group by every non-aggregated column (in this case, createdon and customerid) by including the groupby='true' attribute in each respective attribute element.
Secondly, grouping by the create date of each opportunity is more or less a fruitless grouping, as opportunities are generally created on different datetimes, so this grouping would just return the whole table. Microsoft rightly recognizes this, so if you fix the grouping issue above, you will encounter another exception related to the datetime column. If you continue reading the article I'd previously shared, there is an example that address the different ways you can group by different date intervals (year, month, quarter, etc.) using the dategrouping attribute.
But, I get the feeling that even after fixing the general grouping issues, and then the dategrouping issue, the result set might still not be what you want. If it's not, it might help to post an example of a result set that you'd expect to see and then address whether FetchXML has the power to deliver that set to you.

Change Group Labels in AdvancedDataGrid

I'm trying to use an AdvancedDataGrid to display some grouped data. Normally flex displays this in a "tree view" with a folder icon represent the group. I need to group the data based on an integer ID field in my object, but I'd like the label for the folder icon to display the groupName field in my object.
Here's a little example:
{groupName: group1, ID: 1234}
{groupName: group2, ID: 5678}
<mx:grouping>
<mx:Grouping label="Group"> <--- The label of the whole column
<mx:GroupingField name="ID">
</mx:Grouping>
</mx:grouping>
Resulting output:
=== Group ===
+ 1234
- child
- child
+ 5678
...
But I'd really like to output:
=== Group ===
+ group1
- child
- child
+ group2
...
If anyone has any tips I'd appreciate it.
-- Dan
Have a look at GroupingField#groupingFunction. From the adobe docs:
A function that determines the label for this group. By default, the group displays the text for the field in the data that matches the filed specified by the name property. However, sometimes you want to group the items based on more than one field in the data, or group based on something that is not a simple String field. In such a case, you specify a callback function by using the groupingFunction property.
private function myGroupingFunction(value:Object, field:GroupingField):String

Resources