I am trying to build a table where I am summing multiple measures and would like to categorise them into dimensions.
To simplify, I have a table in the warehouse with the below schema:
Profitability(month_end_date, product_type, existing_direct_variable_expenses, existing_direct_fixed_expenses, existing_indirect_expenses, new_direct_variable_expenses, new_direct_fixed_expenses)
In my measure I am summing existing_direct_variable_expenses, existing_direct_fixed_expenses, existing_indirect_expenses, new_direct_variable_expenses, new_direct_fixed_expenses for one specific product for a date filtered by the user.
I would like to display the below output
Expense | Amount
existing_direct_variable_expenses | 1,000
existing_direct_fixed_expenses | 200
existing_indirect_expenses | 1,500
new_direct_variable_expenses | 500
new_direct_fixed_expenses |50
I have tried to categorise it using the below formula, however it doesn't get past the first condition since each line has a value in each column in the dataset
if(NOT ISNULL(existing_direct_variable_expenses), 'Existing Direct Variable Expenses',
if(NOT ISNULL(existing_direct_fixed_expenses), 'Existing Direct Fixed Expenses',
if(NOT ISNULL(existing_indirect_expenses), 'Existing Indirect Expenses',
if(NOT ISNULL(new_direct_variable_expenses), 'New Direct Variable Expenses',
if(NOT ISNULL(new_direct_fixed_expenses), 'New Direct Fixed Expenses')))))
I also had a play with AGGR function but had no luck.
I realise I could display as measures, however I will also be doing a column for Year To Date expenses and would like to maintain consistency along the other areas of my dashboard by having one column for a month and the breakdown as a dimension.
For references sake, I was able to complete the issue with a Value List. I added the below in my table as a dimension to display the categories:
=valuelist('Existing Direct Variable Expenses', 'Existing Direct Fixed Expenses', 'Existing Indirect Expenses', 'New Direct Variable Expenses', 'New Direct Fixed Expenses')
I then added this into my measure to correctly sum the values against each of the dimensions.
if(valuelist('Existing Direct Variable Expenses', 'Existing Direct Fixed Expenses', 'Existing Indirect Expenses', 'New Direct Variable Expenses', 'New Direct Fixed Expenses')='Existing Direct Variable Expenses',
sum({<product_type={'Sales'}>} existing_direct_variable_expenses),
if(valuelist('Existing Direct Variable Expenses', 'Existing Direct Fixed Expenses', 'Existing Indirect Expenses', 'New Direct Variable Expenses', 'New Direct Fixed Expenses')='Existing Direct Fixed Expenses',
sum({<product_type={'Sales'}>} existing_direct_fixed_expenses),
if(valuelist('Existing Direct Variable Expenses', 'Existing Direct Fixed Expenses', 'Existing Indirect Expenses', 'New Direct Variable Expenses', 'New Direct Fixed Expenses')='Existing Indirect Expenses',
sum({<product_type={'Sales'}>} existing_indirect_expenses),
if(valuelist('Existing Direct Variable Expenses', 'Existing Direct Fixed Expenses', 'Existing Indirect Expenses', 'New Direct Variable Expenses', 'New Direct Fixed Expenses')='New Direct Variable Expenses',
sum({<product_type={'Sales'}>} new_direct_variable_expenses),
if(valuelist('Existing Direct Variable Expenses', 'Existing Direct Fixed Expenses', 'Existing Indirect Expenses', 'New Direct Variable Expenses', 'New Direct Fixed Expenses')='New Direct Fixed Expenses',
sum({<product_htype={'Sales'}>} new_direct_fixed_expenses))))))
Related
When I copy a record (e.g. a page), I would like the content of a field to (always) have the default value, not the value of the original record. But for my custom field, it always has the value of the original record and I can't find configuration to change this (e.g. in the TCA documentation).
(This is not about how the field should be handled when translating, this is just about copying in the default language).
The field TCA is (simplified):
'my_field' => [
'label' => 'Subnavigation',
'l10n_mode' => 'exclude',
'config' => [
'type' => 'check',
'default' => 0,
'items' => [
[
'check box 1',
''
],
[
'checkbox 2',
''
],
],
],
],
my_field has the value 3, currently in the original record. The copied record should have the value 0.
There are several settings to influence the values of copies, the closest one seems to be useColumnsForDefaultValues, I doubt though that it's exactly what you need.
Further options are copyAfterDuplFields, prependAtCopy and hideAtCopy.
On the first linked page is also mentioned that default values in TSconfig can be set, those are only working when a record is opened and empty, so that is likely not solving the problem.
It might also be possible that you had columnsOverrides in mind, I neither see though that this option meets the requirement.
I suppose you need to program a function for it, i.e. on base of the ModifyRecordListRecordActionsEvent.
Another option concerning programming would be using a hook perhaps.
Is there a "quick" way to change the sort order of new content elements in the type dropdown? It seems, that new content elements are pushed to the end of the array, so they appear at the end of the list.
Current position (at the end of list):
Should be:
At the end of group "Standard".
Question:
Is is possible to register a content element to a specific group like "Standard" or "Lists" or a new group?
P.S.: Content element registered correctly in TCA/Overrides/tt_content and in Page TS Config for Wizard. Let me know if the code should be relevant, I will add it then.
Try out ExtensionManagementUtility::addTcaSelectItem() and see argument #3 and #4.
If I want to add a custom group at a certain position, I usually loop over $GLOBALS[TCA][tt_content][CType][config][items] and place it in the right position, if the API is not sufficient in some cases.
You can add new groups using ExtensionManagementUtility::addTcaSelectGroup().
For example,
ExtensionManagementUtility::addTcaSelectItemGroup(
'tt_content', 'CType', 'my_new_group', 'Label for my group', 'after:default');
Other possibilities for position are before:some_group_id, bottom, and top.
Then there is an optional fourth array value in the $item parameter for ExtensionManagementUtility::addTcaSelectItem() which allows you to specify which group you are adding to.
The fourth and fifth parameters to addTcaSelectItem() allow you to specify a position relative to another item in the drop-down.
ExtensionManagementUtility::addTcaSelectItem(
'tt_content', 'CType',
['Label for my item', 'my_new_item', 'my-item-icon', 'my_new_group'],
'some_other_item', 'after');
The "Standard" group is called default. If you reuse an existing group ID, addTcaSelectItemGroup() will return without changing anything.
In my environment it is possible to set the default value for all content elements using
$GLOBALS['TCA']['tt_content']['columns']['rowDescription']['config']['default'] = 'Default Value';
But overriding for one specific content element is not possible:
$GLOBALS['TCA']['tt_content']['types']['new_ce']['columnsOverrides']['rowDescription']['config']['default'] = 'New Description';
All other configurations can be changed (like the label):
$GLOBALS['TCA']['tt_content']['types']['new_ce']['columnsOverrides']['rowDescription']['label']= 'This is the new label';
How can I modify the default value for new_ce?
Afaik not possible currently.
Technical reason in formEngine is that the TCA value defaults are applied before the 'type' is calculated since the default values influence type determination. Thus, they can't be swapped.
Also, this is not possible via page TSconfig since TCAdefaults also handles no type specific settings.
I just wish to know if it is possible to do subtotals in a list component? If so, is it like using a variable and putting the reset type as 'Group' and putting the expression?
There are many limitations of List component (calculations, return values, headers and footers, ...).
See section "13.1.3 List Component Issues" in ireport-ultimate-guide.
Try to use subreport instead list. It is more suited for computation on a subset of data
Yes it is possible.
First you create a variable in the dataset then open variable properties, set calculation sum
Set variable expression which field you want to sum from list component (like $F{paidAmount}) and save
Create a variable in the main report
Open report XML source then go at position in list component and assign value from dataset to main variable like this way
<returnValue fromVariable="sumOfPayment"toVariable="mainSumOfPayment"/>
Example :
<datasetRun subDataset="CreditorList" uuid="6aebc237-1aa2-47db-9435-8b133cef2b31">
<dataSourceExpression><![CDATA[$F{invoices}]]></dataSourceExpression>
<returnValue fromVariable="sumOfPayment" toVariable="mainSumOfPayment"/>
</datasetRun>
then drag the mail variable to the possible you what to show sum that list component field out side of list .and open the variable properties panel and must set Evaluation Time -Report
This is for SugarCRM v6.3
I need to add a "More Info" icon to the History subpanel, which, when moused-over, displays the relevant module's Description field, similar to how the More Info icon works in the Accounts ListView.
For starters I added new "History/metadata" folders to custom/modules/ and copied the subpaneldefs.php file from the core History/metadata folder.
In the subpaneldefs file, at the end of each of the module's column definitions, I added this as a test:
array ( 'customCode' => '<img src="themes/Sugar/images/info_inline.png"></img>', ),
That didn't seem to affect anything at all.
Not sure if it was just that I needed more than an image for the column to show, I then tried adding all of the code I thought was supposed to go there:
array (
'name' => 'nothing',
'module' => 'Notes',
'related_fields' => array ('id'),
'customCode' => '<a id="adspan_{$ID}" href="index.php?module=Notes&action=DetailView&record={$ID}" onmouseover="return SUGAR.util.getAdditionalDetails(\'Notes\',\'{$ID}\',\'adspan_{$ID}\');" onmouseout="return SUGAR.util.clearAdditionalDetailsCall()"><img src="themes/Sugar/images/info_inline.png"></img></a>'
),
This is, as you can see, intended for the Notes in the History subpanel, and I changed it accordingly for each of the other modules' column definitions in the subpaneldefs.php file. I modeled the code after some custom code I found that someone else here at work did for a dashlet, which shows details when an account name is moused over.
Unfortunately, that didn't work, either.
How do I accomplish this?
The only way to do this is by defining a new SugarWidget field for the field in question. Here's a good guide I found for it:
http://www.mediaart.lt/programming/sugarcrm-adding-custom-field-in-subpanel/