Control the order in which customization options appear? - elisp

In my major mode, I have some options defined with defcustom and defface. Each is assigned to the same :group defined via defgroup.
When I do M-x customize-mode, the options all appear and work correctly.
However I don't like the order in which they appear. For example I'd like to put at the top customizations users are more likely to need or want to change.
Unfortunately I can't figure out how Emacs determines the order. For example it doesn't seem to correspond to the order in which they are defined in the .el file, or an alphabetical sort of their doc strings or :tags. Maybe I'm overlooking something obvious, but it seems to be... "random"? In reading Elisp docs and searching online I haven't found an answer.
Is it possible to control the order in which the options appear, and if so, how?

The order of options is determined by C-h a custom.*(sort\|order) RET:
custom-browse-order-groups
User option: If non-nil, order group members within each
customization group.
Properties: standard-value custom-type custom-requests
variable-documentation
custom-browse-sort-alphabetically
User option: If non-nil, sort customization group alphabetically in
`custom-browse'.
Properties: variable-documentation custom-autoload custom-loads
standard-value custom-type custom-requests
custom-buffer-order-groups
User option: If non-nil, order group members within each
customization group.
Properties: standard-value custom-type custom-requests
variable-documentation
custom-buffer-sort-alphabetically
User option: Whether to sort customization groups alphabetically in
Custom buffer.
Properties: variable-documentation custom-autoload custom-loads
standard-value custom-type custom-version
custom-requests
custom-menu-order-groups
User option: If non-nil, order group members within each
customization group.
Properties: standard-value custom-type custom-requests
variable-documentation
custom-menu-sort-alphabetically
User option: If non-nil, sort each customization group
alphabetically in menus.
Properties: variable-documentation custom-autoload custom-loads
standard-value custom-type custom-requests
and implemented by custom-sort-items.
I.e., they can be sorted alphabetically and groups can be placed first or last.
If you want to add custom sorting, you will need to modify the source or use advice.

Related

How to retain order of translations with FormatJS CLI?

When the messages are extracted they are ordered in the extraction file alphabetically according to their randomly generated ids. Is there any way to prevent that and have them ordered in the exact same order in which they appear in the code instead?
E.g. now:
"AYGNrK": translation2,
"BIOgfm": translation1,
"Cqv/CV": translation3,
Wanted:
"BIOgfm": translation1,
"AYGNrK": translation2,
"Cqv/CV": translation3,
If you want to have full control over the exported message, you can use your own formating function.
formatjs extract "src/**/*.{ts,tsx,vue}" --format [path]
In this function, you can sort it i.e. by value. See this example for the general structure of a custom formatter:
https://github.com/formatjs/formatjs/blob/main/packages/cli/src/formatters/default.ts
An altnerative way is to set the custom id with a prefix instead of generating ids. But you need to be aware of naming collisions.
<FormattedMessage
id="component.title"
value="My title"
/>

ODI KM Option - value from FLEX FIELD

Do you think that it's possible to take a value into an ODI IKM Option (for example) from a flexfield?
Example:
You define a flex field on the target table and then pass the value in the IKM.
Then, reading the variable, it's possible to pass it to an option from the IKM?
Thanks,
After searching I found that it's not possible to do it. Conditional Expression can take predefined values. You can find in the next all the combinations:
Condition Expression – It allows you to set the required condition for
the selected option. Double-click the field for editing the condition
expression for the selected option. Click the browse icon Browse icon,
to launch the Edit Expression Editor, which enables you to create or
edit the existing groovy script that determines whether a knowledge
module should be enabled, disabled, displayed or hidden.
Examples are:
return
options.getValue("Cache").equals("true")?"show=true,enable=true":"show=false,enable=false";
This looks at the value of another KM Option called "Cache". If its
value is "false," then the KM Option is hidden, because it's not
relevant.
return
(isStreaming)?"show=false,enable=false":"show=true,enable=true";
This looks at the Mapping isStreaming property. If it's true, then
this option is hidden.
source
It is very easy to do.
You may use odiRef.getTable(java.lang.String pProperty) in the code of your IKM. One of possible values for pProperty is the code of your FlexField.
If you like to pass if through the option just pas <?…?>-substitution as a value of the option. (Probable you should play with %- or ?-substitutions, which is working.)
Refer to «Substitution API Reference» on Oracle site. Many functions like getTable, getIndex, getAK, getContext and others can obtain flexField value of an object of the corresponding type.
Additionally there is the odiRef.getFlexFieldValue() method. It gets the value of any object of any type, but it is required to pass internal IDs as an argument. So it is not convenient.

OBIEE 12C: use of presentation variables

I have a question concerning the use of presentation variables:
1) What's the correct syntax for filtering on a presentation variable is used? You allow a user to select multiple values in a filter eg. A and B. If you use the syntax = '#{PV}{%}' it will result in this sql: = 'A, B' which of course won't exist in the data. I'd like to have this result: in ('A', 'B').
I've already found this syntax: (#{PV}['#']) which gives the correct sql, only thing here is that this doesn't work when you have a dashboard prompt where you allow 'all column values'. When no value is passed to this presentation variable, the analysis throws an error. I have no idea how to put a default value in this one. Any ideas on this?
2) Is there any configuration or setting where you can push obi to use a presentation variable in stead of using the 'normal' way of filtering as shown here:
The obi way is that it changes the relation to the relation in the prompt (if the prompt says 'is greater than' it will change here as well, even though you've put here 'is equal to'), but it will also use a value for this dimension if there's ever been a value for this, rather than listening to the value in the presentation variable of the dashboard prompt. I know that you can translate this to SQL but that's not the way to go for me. The behaviour I'd like is (in this exact order):
- when there is a value in the presentation variable in the dashboard prompt, take this.
- when there is a value for this role of the dimension, take that.
The reason why is because we have this dimension 'Afdeling' which can take up many roles but our customer asked for the roles to be hidden from the end user. This means that even though you switch roles, the end user always sees 'Afdeling' and couldn't care less in which role it is looking at its 'Afdeling'. They can switch between different dashboard pages and if I'd put on top of the page the dashboardprompt of the 'Afdeling' in the role it needed to be, the value won't pass through when switching pages to another dashboardprompt of another role. That way the end user would know something was up. So the value needs to pass through the prompt on each page, no matter what the role of that dimension.
After a bit of googling I've found the answer to question 1 myself. Thanks to this website https://www.obieetips.com/2014/05/obiee-11g-using-multiple-value-for.html I now know that the correct syntax is (#{pv_region}['#']{'West '})

rowscap and filter applied in wrong order in DC.JS rowChart

Still using DC.JS to get some analysis tools written for our tool performance. Thanks so much for having this library available.
I am trying to show which recipe setup times are the worst for a given set of data. Everything works great as long as you show the whole group. When you only display the specified topN using .rowscap on the rowChart the following happens:
The chart will show the right number of bars and they are even sorted properly but the chart has picked the topN unfiltered bars first and then ordered them. I want it to pick the topN from the ordered list, not the other way around. See jsfiddle for demo. (http://jsfiddle.net/za8ksj45/24/)
in the fiddle, the longest setup time belongs to recipeD.
But if you have more than two recipes selected before recipeD
it is dropped of the right (top2) chart.
line 099-110: reductio definition
line 120-140: removal of empty bins (works okay)
(This is very similar to a problem Gordon helped resolved earlier (dc.js rowChart topN without zeros) and I reused the code from that solution. Something went 'wrong' when I combined it with the reductio.js library.)
I think I am not returning the value portion of the reductio group somewhere but have been unable to figure it out. Any help would be appreciated.
The issue is that at the time you .slice(0,n) the group in your function to remove empty bins, the group is not ordered, so you effectively get a random 2 groups, not the top 2 groups. This is actually clear from the unfiltered view, as the "top2" view shows the 2nd and 3rd group from the "all" view, not the actual top 2 (at least for me).
The previous example worked because Crossfilter's standard groups are ordered by default, but in the case of a complex group like the one you are generating with Reductio, what should it order by? There's no way it can know, so Reductio doesn't mess with the ordering at all, which I suppose means it is ordering by the value property, which is an object.
You need to add one line to order your FactsByRecipe group by average and I think it should fix your problem:
FactsByRecipe.order(function(d) { return d.avg; });
Note that there can only be one ordering on a Crossfilter group, so if you want to show "top X" for more than one property of that group you'll need to create another wrapper (like the remove empty bins wrapper) but have the "top" function re-sort the group by the ordering you want.
Good luck!

Access to iterated controls in repeated sections in Orbeon

When setting repeated content in a section in Orbeon each control is repeated and the their names are the same. How do I access the the control from the first, second...etc instance of a control from each iterated section? I'm thinking along the lines of $control-name[instance#] or something similair.
The following works, given this form:
$name[2]: return the second value
string-join($name, ', '): join all values with commas
count($name): return the number of values
See also the relevant documentation.
To access this value in "bind" section, you can use a relative path , like ../name=''.
TO access this value in "body" section, then you can use context()/../name.
If you are trying to make anything different, be more specific and this answer can be edited to be according to what you want.

Resources