XSD change the available elements based on a previous Element Value - xsd

Is there a way to change the available elements based on a previous element value?
I have some lookup 'Cause' codes but some of these only belong to certain 'Products'.
I therefore want to create each products lookup cause code enumeration and let this only be available based on the product selection.
Is this possible ?
Many Thanks

I don't think those sort of "business rules" can be expressed in XSD.
One option is to also create schematron validation rules to enforce those sort of conditional structure rules based upon element/attribute values.

You can effect element polymorphism (of the same name) in the XSD for instance elements decorated w/ enumerated xsi:type attributes as described
here

Related

How to modify dynamic complex data type fields in azure data factory data flow

This bounty has ended. Answers to this question are eligible for a +400 reputation bounty. Bounty grace period ends in 22 hours.
kevzettler is looking for a more detailed answer to this question.
I have a complex data type (fraudData) that undesirably has hyphen characters in the field names I need to remove or change the hypens to some other character.
The input schema of the complex object looks like:
I have tried using the "Select" and "Derive Column" data flow functions and adding a custom mapping. It seems both functions have the same mapping interface. My current attempt with Select is:
This gets me close to the desired results. I can use the replace expression to convert hypens to underscores.
The problem here is that this mapping creates new root level columns outside of the fraudData structure. I would like to preserve the hierarchy of the fraudData structure and modify the column names in place.
If I am unable to modify the fraudData in place. Is there any way I can take the new columns and merge them into another complex data type?
Update:. I do not know the fields of the complex data type in advance. This is a schema drift problem. This is why I have tried using the pattern matching solution. I will not be able to hardcode out kown sub-column names.
You can rename the sub-columns of complex data type using derived column transformation and convert them as a complex data type again. I tried this with sample data and below is the approach.
Sample complex data type column with two sub fields are taken as in below image.
img:1 source data preview
In Derived column transformation, For the column fraudData, expression is given as
#(fraudData_1_chn=fraudData.{fraudData-1-chn},
fraudData_2_chn=fraudData.{fraudData-2-chn})
img:2 Derived column settings
This expression renames the subfields and nests them under the parent column fraudData.
img:3 Transformed data- Fields are renamed.
Update: To rename sub columns dynamically
You can use below expression to rename all the fields under the root column fraudData.
#(each(fraudData, match(true()), replace($$,'-','_') = $$))
This will replace fields which has - with _.
You can also use pattern match in the expression.
#(each(fraudData, patternMatch(`fraudData-.+` ), replace($$,'-','_') = $$))
This expression will take fields with pattern fraudData-.+ and replace - with _ in those fields only.
Reference:
Microsoft document on script for hierarchical definition in data flow.
Microsoft document on building schemas using derived column transformation .

Multi LookUp - Check for unique values

I´m trying to set up unique values in my PowerApp-Form. The data is stored in a Sharepoint list. I have a column called watches, items in this column have a unique number, which have to be unique. People can pick multiple of those watches in a LookUp-field. But before submitting the form, I need to check if those picked values already exist in my list and at least display an error message.
I have setup a regular text field and added following rule to it:
If(LookUp(MyList.Watches;DataCardValue4.SelectedItems.Value in Watches;"OK")<>"OK";"No Error";"Watch already exist")
DataCardValue4 is my LookUp field, where people can pick those watches. With this rule I want to check if a item already is in my column watches and let my text field display the error. Somehow the rule doesn´t work.
Can you tell me how I compare multiple lookup choices to my table/column entries?
The first parameter to the LookUp function should be the table (SharePoint list) rather than the column. So the first parameter should be 'MyList' rather than 'MyList.Watches'. Also, I'm not sure that the formula provided (second parameter to LookUp) will work. In your formula, you will be looking for multiple items (DataCardValue4.SelectedItems.Value) within multiple items (Watches). Perhaps you can update your app to have users only pick one watch value before submitting?
One last thing to note. I'm not sure how big you expect your SharePoint list to get, but I would highly recommend keeping your LookUp formula within the bounds to support delegation. More specifically, SharePoint has different formula requirements than other connectors. For example, you can use '=' in your formula, but not 'in'.
Your new rule might look something like below. Please note that it could have syntax errors and might not even be delegable in it's current form since I am providing the rule with no checking. Also, I switched from using LookUp to using Filter instead just because I'm more familiar with Filter. However, both functions are very similar.
If(CountRows(Filter(MyList; DataCardValue4.Selected.Value = Watches)) > 0; "Watch already exist"; "No Error")

Excel - how to create a dependent drop down list that uses different levels?

I'm trying to determine how to create a dynamic drop-down list that will take into consideration two different attributes.
In my example below, I have three cost elements: Labor, Infrastructure, and Licenses. Each of these have different levels. For example, Labor at L1 has: Storage Management, Database Managed, and Compute Management. At L2 it has: Manager, Vice President, and Managing Director.
I want in cells E18:F20 for each cell to have a drop down list, for that cost element and for that level.
I've tried using the "Indirect" formula but you need to have the specific named range. I need something that can look up a range based on two attributes, the cost element and level.
Anyone know what I should type in the Data Validation field?
Named ranges cannot have spaces, so your range names will have to use an underscore or omit that character altogether for the dependent ranges. For example "LaborL2".
Define all these named ranges, LaborL1, LaborL2, InfrastructureL1, etc.
Then you can use the Indirect function to concatenate $F18 and G$17. like
=INDIRECT($F18&G$17)
Then you can see the correct list in the dropdown.

Search for exact term in an Algolia index

I want to filter an index by an exact value of an attribute. I wonder what possibilities Algolia offers for that.
Querying an index always results in a search for substrings, that means a search term abc will always match any object which attribute values contain abc. What I want to achieve is a search for abc that finds only abc as a value of an attribute (in this case I have specific attributes to search in).
One possibility I came up with was tagging, which doesn't seem to be the best way to think of.
Edit
I think I could also use facet filters. I thought about the different pros and cons and can't come up with arguments that places either one position above the other.
You're right with your edit that facet filters would be the way to go on this one. You'll get the exact match you're looking for and won't have to create a new attribute of _tags to use the tag filter.

what is RowOrdinal property in Sharepoint FieldType Definition

In Sharepoint it is not possible to add more than 16 Lookup-Fields to a single list.
This limit is explained here: http://support.microsoft.com/?scid=kb%3Ben-us%3B823555&x=6&y=5
I found a workaround for it: The RowOrdinal-Property in FieldDefinition in schema.xml is default setted to = "0". You cann add more fields of one fieldtype than the limit by setting the "RowOrdinal"property for the 17th Lookup-Field to "1".It works.
The only disadvantage of this workaround is that a filter using this field doesn't work correctly.
Can anybody explain to me what is the RowOrdinal-Property for? Or has anyone another solution defining more than 16 Lookup-Fields in one single list?
I think you are using the RowOrdinal property as intended as you can find the following definition on MSDN:
tp_RowOrdinal: The zero-based ordinal index of this row in the set of rows representing the list item. Additional rows are used to represent list items that have more application-defined columns of one or more datatypes than can fit in a single row in the AllUserData table.
You can find the full description of the content database table columns here:
http://msdn.microsoft.com/en-us/library/cc704499.aspx
But I do unfortunately not have an explanation why your lookup columns does not work as a filter.

Resources