FIX repeating groups to reuse same tags - quickfix

Does FIX protocol allow to reuse same tag in a message and in repeating groups? I.e. could I have something like that
<message name='Quote' msgtype='S' msgcat='app'>
<field name='Price' required='Y'/><!-- i.e. total price for the whole quote-->
...
<group name='NumLegs' required='Y'>
<field name='Price' required='Y'/><!-- i.e. leg price -->
...
<group name='NumLegDetails' required='Y'>
<field name='Price' required='Y'/><!-- i.e. leg component price -->
...
</group>
...
</group>
</message>

TL;DR
It is not allowed in the tag-value encoding.
(but in FIXML it is)
Some explanations
My initial misunderstanding came from this statement in the FIX tag-value specification: see here, search for "Field presence"
A tag (field) must appear at most once in a message, except when the
tag appears within a repeating group.
But as I learned this refers to the wire format of the message, not the definition of the message.
Whereas the FIX5.0SP2 spec Volume 1 refers to the definition of the message and states:
A tag number (field) should only appear in a message once. If it
appears more than once in the message it should be considered an error
with the specification document.
In the meantime I even found it mentioned in FIXimate when looking at the NestedParties component (emphasis mine): (link to NestedParties component in FIXimate)
The NestedParties component block is identical to the Parties Block.
It is used in other component blocks and repeating groups when nesting
will take place resulting in multiple occurrences of the Parties block
within a single FIX message.. Use of NestedParties under these
conditions avoids multiple references to the Parties block within the
same message which is not allowed in FIX tag/value syntax.
BTW, there are also components NestedParties2, NestedParties3, NestedParties4 to work around this.
Information from FIX Trading Community Forum
The thread can be accessed here, but as far as I know you can only access it if you are a FIX TC member: FIX TC forum
The FIX expert Hanno Klein gave the following information:
The quote from the refactored online spec refers to the wire format of
any instance of a message encoded in tagvalue syntax. It means that
inside the wire format of a single repeating group a tag (field) may
appear more than once.
FIXML does not have this restriction:
The restriction is actually limited to the tagvalue encoding. For
example, the parties component is “Pty” for all instances in FIXML,
the XML syntax/encoding of FIX. This is due to the fact that the XML
syntax has an unambiguous structure with a distinct path to every
occurrence of a component or field. The XML names only need to be
unique within the same element.
Tag-value does:
For tagvalue, a parser needs to know when a repeating group starts and
ends. The NoXXX field marks the starting point and a field that is not
part of the group marks the ending point. There are no explicit
delimiters for repeating groups in tagvalue and components
(non-repeating) are not visible in the wire format at all.
Technically, you are probably right that a Price tag could exist in
two distinct repeating groups without causing a parser issue but I do
not see the benefit to allow this exception to the rule. You cannot
allow it for two adjacent levels, e.g. root + nesting level 1 or
nesting level x + nesting level y.
This part from original answer still applies
On another note, when defining your own repeating groups please use the notation NoXXX for repeating groups since that is the official recommendation. see here, search for "NumInGroup field"
It is recommended that NumInGroup fields be named NoXXX, e.g.
NoContraBrokers(382).
However, following your example with 44/Price you would normally see 566/LegPrice used as the price for an individual leg since the two are used differently. The former is the price used for the execution of an order, the latter is used when defining a leg of a strategy.
So in short, when defining your message structure and repeating groups you should really think about if the meaning of the tag is the same for all occurrences of the tag in the message and if it really makes sense to use the very same tag in the body and in repeating groups. Clarity should be first priority.
incorrect (strike through) part of original answer
At first I thought that this could not be allowed but mainly because I have never seen it appear somewhere in a real message. But actually I could not find a reason why it should not be allowed. The specification only says: see here, search for "Field presence"
A tag (field) must appear at most once in a message, except when the
tag appears within a repeating group.
A tag (field) must appear at most once per repeating group instance.

No, this is not allowed. I suggest you get a large data dictionary from http://www.quickfixengine.org, save it to your computer in XML format, and then execute a command like the following:
grep Price FIX.xml | grep number
Doing that will show you the definitions of all the Price-related fields. If you search for each of those field names within messages/components, you will see that each one is used in a different place. The overall result is that each field is listed only once in a message.

You can't re-use a repeating group tag outside a repeating group.
The declaration of a tag as a repeating group tag puts constraints on it, such as its order within a group and how one occurrence is treated differently to a subsequent occurrence. Non-repeating group tags have no such constraint.

Related

Visio ShapeSheet ShapeData: keep two rows in sync

I have two Shape Data rows for a Shape's ShapeSheet:
Shape Data Label Prompt Type Format Value Invisible
Prop.Type "Type" "" 4 "Alpha;Beta;Gamma;Delta;Epsilon;Zeta;Eta;Theta;Iota;Kappa" INDEX(4,Prop.Type.Format) False
Prop.Abbrev "Abbrev" No Formula 4 "A;B;G;D;E;Z;E;T;I;K" INDEX(4,Prop.Abbrev.Format) True
The way I intent to use this is to have the user select the Type, say Epsilon, and then have the Abbrev automatically switch to the corresponding value in the Prop.Abbrev.Format.
Note: the values used here are placeholders for the actual values for my application, which are not shown here so they don't distract from the real answer I need, how to keep the selections in sync when the first one is chosen or changed.
Thanks for any help you can give!
I don't have Visio on this machine, so I am unable to copy and paste a working solution. The approach gets a little complicated, but extremely flexible.
Save your lists in the User section, rather than Prop - this then becomes underlying data for use in properties. If you are using a master stencil then this also helps with managing the fields.
You can now store an index in your data as well - this index points to the appropriate values in your arrays. You can use Actions and side menus to set the index which, when referenced properly, means you can have the full name and/or abbreviation in the side menu and the ShapeSheet does all the work underneath.
The functions you want to look at are:
Index (e.g. INDEX(1,User.Type) will return "Beta". (0-based)
Lookup (e.g. LOOKUP("D", User.Abbrev) will return "3". (0-based)
GetAtRef
SetAtRef
SetAtRefExpr
SetF
I had a similar business problem which relied on setting a background colour based on the value of shape data. Your final solution could end up including formulas like this: =SETF(GetRef(Prop.Type),"GUARD(INDEX(LOOKUP(Prop.X,Prop.X.Format),User.Type))").
For more in-depth discussion - check out https://superuser.com/questions/1277331/fillforegnd-in-shapesheet-using-wrong-data and the extended discussion at http://visguy.com/vgforum/index.php?topic=8205.15 - the latter link also includes an example file with working shapesheets (well, working to the extent that they exposed my problem).

How can I semantically define within the <time> tag 'the present'

I am using time tag to define a time—seemed like the right approach ;-)
My problem however is the value I want to place within the time tag is NOW: the present. I get this validation error:
The text content of element time was not in the required format:
The literal did not satisfy the time-datetime format."
Looking at the spec, it doesn't seem possible to define 'NOW'. That's a nuisance. Any ideas on how to approach this?
You cannot. The time element in HTML5 is defined as markup for specific moments or periods or durations of time or for time offsets, not for all concepts related to time.
You can write e.g. <time datetime="2013-04-06T13:53">now</time>, thereby associating a fixed moment of time with the text content “now”. I don’t see how this could be useful, and the usefulness of the time element in general is questionable (it looks like markup for markup’s sake), but things like this are all you can do to “define ‘NOW’” with time.
I'm using this markup for now:
<time datetime="2013">Present</time>
No more errors, and it's symatic. It's just a shame there is no accepted variable for NOW.

MS Word 2007 - How to set up placeholder text to mimic text but not formatting

I'm probably biting off more than I can chew with this particular problem, but I'll try to be as specific as possible in case it's within my scope. Disclaimer: I'm not terribly experienced with MS Word, beyond simple data entry/some formatting, and I have absolutely zero experience working with macros or VBasic. Unfortunately, I'm afraid the solution to my problem will come in the form of one of those last two.
THE GOAL:
What I want to do is to have placeholder text throughout my template document that will change content but not formatting when the first instance of it is changed. Basically, I'm writing a template for support manuals for a software suite. Each app has certain similar features like the menu bar, data entry screen, diagnostic log screen, transaction history, etc., so I am pre-writing those sections and using placeholders when I need to insert certain app specific properties.
I started off using the Insert->Quick Parts->Document Property->Subject tool which I used as a placeholder for the app name. I set the Property to [Subject] and then used Insert->Quick Parts->Field->Subject throughout the document, wherever I needed to include the app name. This worked fine in this case because the app name will always be capitalized. I simply change the text in the first [Subject] (which is content controlled) and update the fields throughout the document, and they all match nicely, easy-peasy, work done, go home and drink beer, right?
Not quite.
Our software handles part tracking via scanners and SQL Server, so while the interface and menu in the apps remains largely unchanged, the parts they track change from app to app. Because of this, I need to change the part name when I reference it within the text of the manuals; for example, if I'm working in ToiletPap.app and our TP is tracked by the roll, I need every mention of [Component] to be changed to roll. If I'm working in LightBulbs.app, I need [Component] to say bulb.
My first efforts went toward creating a custom doc property called Component using the Advanced tab under the Document Properties dropmenu. I then created a plaintext content control around my first [Component] titled Component and made my next [Component] a field with modified code: {COMPONENT * MERGEFORMAT}. This comes from copying what I can find when [Subject] works. This didn't work at all; updating the text in the first CC doesn't change the Content doc prop, and my fields return "!Undefined Bookmark, COMPONENT".
I got close to what I need by using the [Comments] doc property, set initially to [Component]. I used it just like [Subject], but (this is when I realized that capitalization was going to be an issue) when I mention my [component] in-text, as often as not, I need to to be lowercase instead of upper.
I've looked on MS's forums and a few others as well as here on SO, and I can't find anyone who's trying to do the same thing, much less an answer to how. Please keep in mind when answering, it would be a great help to me if you would include step-by-step instructions on how to enter/implement the code you provide because, as I mentioned, I have no idea how to go about editing macros/VBasic for MS Word.
To restate and summarize my overall question: How can I use a placeholder that displays the text "[Component]" so that, when I change the first instance of [Component] to something else, say "hopper", every subsequent instance of [Component] is updated to hopper but maintains its current capitalization and formatting scheme?
Apologies for the length of the request, but I wanted to make sure I explained the situation as accurately as possible. Thanks in advance for your consideration and responses.
I managed to solve this one after a couple extra hours of tinkering. I didn't need macros or VBasic, either.
On the first instance of [component] I created a plain-text content control to act as a container (not a necessity, but it makes it look nicer. Will likely cause a problem eventually, but for now, it's working as intended) and bookmarked it. Then, for all other instances of [container] I selected each and used Insert->Quick Parts->Field->Ref with the following field code:
REF Text1 \*Lower
Where "Text1" is my bookmark and "*Lower" indicates all lower case. The *Lower can be replaced with *Upper or *FirstCap to indicate all upper case or capitalize the first letter respectively. Now, each field reflects the text of the first with the capitalization appropriate to each field's location within the document. Just like using the doc prop with [Subject], ^a -> f9 is needed to update all fields within the document.

Is it allowed to use <label> tag without labeled control?

I need to show in a page a list of, let's say, person's properties that should be rendered more or less as follow:
name: Name
date: 1/1/2000
other: Other
Reading the doc they say:
The LABEL element may be used to attach information to controls.
So, is it the right tag to encompass the names of the properties like name, date...
even if there's not an <input> to associate with?
Nope, as per Quentin’s answer.
However, in HTML5, <dl> can be used for generic associations where <label> isn’t appropriate.
No.
It says that it can associate information with controls.
It does not say that it can associate information with anything else.
See also the newer (but draft) specification:
Some elements, not all of them form-associated, are categorized as
labelable elements. These are elements that can be associated with a
label element.
button input (if the type attribute is not in the hidden state) keygen
meter output progress select textarea
No, it is not correct to use the label element like that.
The important thing here is the meaning of may.
The LABEL element may be used to attach information to controls.
RFC 2119 (which the HTML4 spec follows) defines may:
May: This word, or the adjective "OPTIONAL", mean that an item is truly optional
So here, may does not mean the label element can be used for other purposes; it just means that it is not required to use a label element with controls.
As far as alternatives go, it depends what you want to achieve. If you are just trying to follow the spec closely, then I suggest using p and a strong element for each pair. If you want the data to be more meaningful to computers, you could consider using one of the Microformat specifications.
I partially agree with the answers so far but want to add that if you want to use labels for some reason, then I would display the property values in read-only controls, and then your labels will be valid.
I've done this using appropriate styling to differentiate the read-only controls from the functioning controls to avoid confusing your users. This was on a sequence of pages which built up the information gathered from the user in a wizard.
I have this link to W3C - the "Editor's Draft" as opposed to the link above which is the "Working Draft", which states that you can associate it with any element - as long as it's 'labelable' - even though this is a subsection of the Form section. It states earlier that a labelable element does not have to be within a form.
http://dev.w3.org/html5/spec/single-page.html#the-label-element

Are there ways to work around the limitations of the Open Graph action story attachment caption template?

There are 3 specific limitations of open graph action attachment captions that I'm trying to work around. I'm referring to the attachment caption that is configurable in the Action configuration page (e.g. https://developers.facebook.com/apps/<app-id>/opengraph/action_type/<action-type-id>).
I can't find a way to insert newlines or line breaks. I'm guessing this is probably by design, but it seems like a reasonable thing to be able to do.
If the action can be applied to more than one object type, you can't use fields from either object in the caption template. If you do, the caption "breaks" (displays incorrectly) when you reference a field from an object that is unset.
For example, action "drive" could be associated with "car" or "truck". If the caption is {car.model}, then it breaks for trucks. Related to this post. Ideally I'd like to be able to do something like ({car.model} OR {truck.make}).
Optional action/object fields can't be used in the caption, because if they're ever unset, the caption "breaks" just as in #2 above.
When I say the caption "breaks," I mean that it displays incorrectly. It seems to go into a debug mode where it displays fieldName fieldValue pairs for various fields from the object/action.
Are there any workarounds for these 3 issues?
Note that I'm not dealing with aggregations, just the actual action Open Graph post.
UPDATE: It looks like Facebook just pushed a change within the last day to allow multiple lines of caption. That solves item #1. Item #2 and #3 are still outstanding.
UPDATE 2: For #2, if you only put a single template item per-line (e.g. {someobject.somefield}), it seems to work OK. If that option is unset, that line doesn't display. However, if you put more than one field, it seems to resort to the "breaking" behavior. This might also work for #3, haven't tried yet.
As stated in the updates above:
Facebook made a change to allow multiple lines of caption. That solves item #1 directly, and items #2 & 3 indirectly...
For #2 & #3, if you only put a single template item per-line (e.g. {someobject.somefield}), it seems to work OK. If that option is unset, that line doesn't display. However, if you put more than one field, it seems to resort to the "breaking" behavior. This might also work for #3, haven't tried yet.