field in semantic mediawiki with options where label and value are different - mediawiki

How can I have a select field (e.g. combobox, tokens) with options where label and value are different in semantic media wiki?
I tried "Allows value list" with json. The list works but somehow I can't use it as datasource for a field.
A mapping template could work but is hard to maintain because the syntax of the template is very confusing for users compared to json and the values are stored in two pages (form and mapping template)

Related

How to retrieve id's and names of all fields of a particular type from html to Django views

I have a html form with a list of input fields with id's, names and values. Is there a way I can get these values in Django views by only mentioning the input type. For example : get the id's and values of all input elements with type text.

How to get the formatted autonumber value in MS Access to appear in form control as a formatted value?

I have an ID field with an AutoNumber Data Type that has a custom format defined in the Field Properties (A-00001, A-00002, etc).
I wanted to look up the formatted value and display it in a form textbox control.
ServiceNumber_entry = DLookup("ServiceID", "ServiceRecord", "SNID = '" & Forms!ServiceEntry!PartSN_entry & "'")
Using the line above, it returns just the number value and not the full formatted value (i.e. 1 instead of A-00001). What am I missing?
Existing comments all contain good information, but it can be useful to put it all together. The comments also failed to describe the context in which Access automatically copies and applies properties like Format, so that the comments (even if correct) might seem contradictory. My explanation is a bit verbose, but hopefully avoids further confusion.
The purpose of the Format property for any value in Access is to define how the data is displayed. This is true of a table column presented in a datasheet or a textbox control on a form. The Format does not define how values are stored, either in storage or in memory. The same value could be formatted and displayed differently without affecting the underlying stored datum. In this case, the Autonumber values are really Long Integer values. (They are not stored with a preceding "A-", which would require the values to be strings and would ruin Access's ability to automatically increment the values.)
Access attempts to provide a consistent view of the data and reduce tedious programming details by automatically copying the Format property to queries and form controls, just as it does with many other metadata properties. For instance, if you drag the AutoNumber field onto a form in design mode, it will automatically copy the Format string from the column to the TextBox control's Format property. In contrast, if you include the same column in a query, the query's column property sheet also has a Format property, but it will remain blank by default. However, when the query is executed, it will indeed be displayed with the format defined on the table column. This behavior does not mean that the data values themselves "have a format", rather Access is just doing its automatic work of looking up default formatting values from the table definition and applying it to the query's output. (It can do this if there is a simple one-to-one table column to query column relation, which is the usual case for queries.)
DLookup() is a Visual Basic (VBA) function. It is necessary that such functions handle the "raw" data independently of metadata, like Format (or Caption, Text Alignment, etc.). For coding purposes, a programmer expects to retrieve the actual long integer value from the column, not a formatted string value like "A-00001". The function will not only skip the format, the formatting information is completely dropped from data values. In a programming environment, data can be combined and manipulated and the concept of "format" becomes lost and/or meaningless. Even though in this case it might seem obvious, DLookup makes no assumptions about what you're going to do with the data and so just returns the integer values.
If your form TextBox control was not originally placed on the form specifically for the AutoNumber field, Access would not know to the copy the Format property. It would just display the integers from DLookup() as basic integers. However, you can manually set the TextBox's Format property to match the table column's Format property exactly to get back the expected values.

Multiple Values in one "SMW Page Forms" field

I ran into a problem with Semantic Mediawiki using the Page Forms extension.
I wanted to create a field in a Page Form, that can take more than one value. So I decided to use the tokens input type.
The problem is the following: If I type some values into the form field and save the page, Page Form puts all the values - seperated with commas - into one single SMW value.
For example: I have a form that will create a page about a scientific paper. And in this form I have a field that is called Authors. And when I fill the field with two Authors, lets say Pascal and Tesla, then the final page does not have the two SMW values [[Author::Pascal]] and [[Author::Tesla]] - It has the SMW value [[Author::Pascal, Tesla]].
Does anyone know, how I can achieve the mapping from different values in the form field to different values as SMW strings?
Thanks and greets,
J
Multiple values for the same field covers this.
Put the following in your corresponding template:
{{#arraymap:{{{Author|}}}|,|x|[[Author::x]]}}

Searchable MultiSelect or the best approach

Users of a report have requested the ability to be able to manually enter a code, currently they are are presented a multiselect with all the codes related to the previous parameters.
This is in Report Builder 3.
This multiselect can become quite long so I thought another approach would be a searchable multiselect. Is this possible in any: way, shape, or form?
Could I allow for a cascading parameter (which is the code) to be either selected either through manual typing or another means.
I would add a type-in text parameter (lets call it Search_Code), with a default of % (assuming your data source is SQL).
Then in the data source for the Code list, I would add to the WHERE clause e.g.
WHERE Code LIKE '%' + #Search_Code + '%'
This will restrict the Code list to strings which partially match the Search_Code value (if entered).

Magento - change multiselect semantics from "or" to "and"

When more than one value of a multiselect is used as a filter on a catalog or catalogsearch page in Magento, the multiple values are or'd together - i.e. the result is the union of the products that have any of these attributes.
How would I get the intersection of the sets of products with the selected attributes - i.e. only those products that have all of the selected attributes?
In the standard behavior of Magento you can only filter for one value like Lucasmus already indicated.
So you seem to be using some customization or module which edits the behavior of the core/Mage/Catalog/Model/Layer/Filter/Attribute.php model.
Also the class Mage_Catalog_Model_Resource_Eav_Mysql4_Layer_Filter_Attribute has to be rewritten, this is exactly the class where you could change the behavior you asked for.
In that class, the method
applyFilterToCollection($filter,$value)
creates the corresponding SQL code to do the filtering.
Currently your module or extension probably uses an OR notation, or uses something like
$connection->quoteInto("{$tableAlias}.value IN (?)", $value),
so it searches for any of your to be filtered values.
To achieve an AND, you will have to rewrite this method by splitting the $value into its distinct parts and using a where clause for each of the individual values.
Hope that makes sense.