Orbeon, file reponsible for completed forms - persistence

I'm looking for file which is responsible for model of completed data in xml. For example it looks like:
<form xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:saxon="http://saxon.sf.net/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fb="http://orbeon.org/oxf/xml/form-builder" xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:version="java:org.orbeon.oxf.common.Version" xmlns:sql="http://orbeon.org/oxf/xml/sql" xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:exf="http://www.exforms.org/exf/1-0">
<section-1>
<control-3>name</control-3>
<control-1>second-name</control-1>
</section-1>
</form>
This example could store simple form which contains two input field (name, second-name).
I want to find it, because I want to add parameter contains id of user who complete this form. So I want to change model, to reach following effect in completed form xml:
<form xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:saxon="http://saxon.sf.net/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fb="http://orbeon.org/oxf/xml/form-builder" xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:xbl="http://www.w3.org/ns/xbl" xmlns:version="java:org.orbeon.oxf.common.Version" xmlns:sql="http://orbeon.org/oxf/xml/sql" xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:exf="http://www.exforms.org/exf/1-0">
<user-who-complete-this-form-ID>100</user-who-complete-this-form-ID>
<section-1>
<control-3>name</control-3>
<control-1>second-name</control-1>
</section-1>
</form>
Or maybe someone knows other way to provide id of user who complete form to own persistence layer?
regards

This looks like the data for a form you created in Form Builder. If that is indeed the case, and you want to add a field, you can do it from Form Builder, republish the form, and the instances of the new form will have the additional field you added.

Related

Filemaker: values form related table

I have 2 tables, DATA and IMAGES, in a relationship based on item_number.
Records in DATA each have 3 records from IMAGES gathered.
For example, a record with item_number 010050 is linked to these records in IMAGES:
010050.eps
010050_table.tif
010050_drawing.png
In the corresponding record in DATA I have the fields:
main
table
drawing
My aim is to set the fields in DATA like:
010050.eps => main
010050_table.tif => table
010050_drawing.png => drawing
I tried:
ExecuteSQL("SELECT filename FROM images WHERE filename = ?"; ""; ""; "010050_drawing")
Who could give me a hint?
I couldn't figure out how I can do that in xslt.
To take a simplified example, suppose you have exported from your Data table, with only two fields included in the export: Data::ItemNumber and Images::FileName. Your raw export would then look something like this (two records shown):
XML
<?xml version="1.0" encoding="UTF-8"?>
<FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
<ERRORCODE>0</ERRORCODE>
<PRODUCT BUILD="" NAME="FileMaker" VERSION=""/>
<DATABASE DATEFORMAT="" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT=""/>
<METADATA>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="ItemNumber" TYPE="NUMBER"/>
<FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Images::FileName" TYPE="NUMBER"/>
</METADATA>
<RESULTSET FOUND="2">
<ROW MODID="0" RECORDID="1">
<COL>
<DATA>010050</DATA>
</COL>
<COL>
<DATA>010050.eps</DATA>
<DATA>010050_table.tif</DATA>
<DATA>010050_drawing.png</DATA>
</COL>
</ROW>
<ROW MODID="0" RECORDID="2">
<COL>
<DATA>2345</DATA>
</COL>
<COL>
<DATA>2345_extra.gif</DATA>
<DATA>2345_table.gif</DATA>
<DATA>2345_drawing.jpg</DATA>
<DATA>2345.tiff</DATA>
</COL>
</ROW>
</RESULTSET>
</FMPXMLRESULT>
Note the different order as well as the extra image in the second record.
After applying the following stylesheet:
XSLT
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fmp="http://www.filemaker.com/fmpxmlresult"
exclude-result-prefixes="fmp">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<root>
<xsl:for-each select="fmp:FMPXMLRESULT/fmp:RESULTSET/fmp:ROW">
<xsl:variable name="item-no" select="fmp:COL[1]/fmp:DATA"/>
<item>
<number>
<xsl:value-of select="$item-no"/>
</number>
<main>
<xsl:value-of select="fmp:COL[2]/fmp:DATA[starts-with(., concat($item-no, '.'))]"/>
</main>
<table>
<xsl:value-of select="fmp:COL[2]/fmp:DATA[starts-with(., concat($item-no, '_table.'))]"/>
</table>
<drawing>
<xsl:value-of select="fmp:COL[2]/fmp:DATA[starts-with(., concat($item-no, '_drawing.'))]"/>
</drawing>
</item>
</xsl:for-each>
</root>
</xsl:template>
</xsl:stylesheet>
you would obtain:
Result
<?xml version="1.0" encoding="UTF-8"?>
<root>
<item>
<number>010050</number>
<main>010050.eps</main>
<table>010050_table.tif</table>
<drawing>010050_drawing.png</drawing>
</item>
<item>
<number>2345</number>
<main>2345.tiff</main>
<table>2345_table.gif</table>
<drawing>2345_drawing.jpg</drawing>
</item>
</root>
Honestly, unless there's more happening than what you've described, you're making this too hard.
If there will always be exactly 3 IMAGE records for each DATA record, and especially if you want to directly relate each image to a specific type, you don't need the IMAGE table. A much simpler solution would be to add 3 container fields to your DATA table (say, main_image, table_image, drawing_image). You wouldn't need SQL or a portal, and you wouldn't have to worry about keeping related images linked to their type.
OTOH, if you truly need a separate table, consider hard-wiring three dedicated 1:1 relationships, one for each image type. To do this, add 3 special key fields in DATA: (main_image_id, etc.) and create a relationship for each image type, each between one of these fields and the primary IMAGE. Then, whenever you create a DATA record and 3 related IMAGE records, put the key of the matching image in the matching DATA::xxx_image_id field. That way, you'd have a clean 1:1 relationship, and each related image would be locked to its type.
thanks for your replies
I need the value of the images in those fields to get it exported to XML and InDesign (into table cells).
The issue is that I know the filenames , namely the item_number followed by _drawing or _table, but don't know the extension on forehand (many files and from different sources)
File formats differ therefore.
My solution now is:
- imported all the images in a related (item_number, his is also part of the filename) a FMP table
- I calculated whether the file is a table, drawing or illustration and put those values in a field 'kind' by:
Case (
PatternCount ( filename ; "_drawing." ) ;
"drawing" ;
PatternCount ( filename ; "_table." ) ;
"table" ;
Length ( filename )=10 ;
"main" ;
""
)
- then I did the query in each of the fields, main - table - drawing. The one below is the calculation in the 'table' field.
ExecuteSQL("
SELECT path_xml
FROM images
WHERE item_number = ? and kind = ?";
"";""; item_number ; "table"); ""
)
Perhaps a bit clumsy, but it works now.

Ektron Forms - Generate Plaintext Email

In Ektron I have a form that generates an HTML email on submission and sends it to a mailbox (foo#bar.com). An application (MailReader) checks that mailbox, reads the messages, strips all markup, and saves the resulting messages for later use. This is a problem because all the text from the HTML email end up getting mashed together and are completely unreadable by someone using the MailReader app.
For example, this HTML:
<h1>Header1</h1>
<div>
<h2>Header2</h2>
<p>Some text in a paragraph.</p>
</div>
Becomes:
Header1Header2Some text in a paragraph.
I cannot change MailReader in any way, it will always strip any markup so my solution is to have Ektron generate an email that contains no HTML for just this form. I know the email is generated using XSLT transformations with the file /Workarea/controls/forms/DefaultFormEmailBody.xslt.
My attempt at my solution involved adding a hidden input to the form with name "__nohtml". Then the XSLT will do the following:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:choose>
<xsl:when test="/field[starts-with(#name, '__nohtml')]">
<xsl:output method="text" />
</xsl:when>
<xsl:otherwise>
<xsl:output method="html" />
</xsl:otherwise>
</xsl:choose>
<xsl:template match="/">
<xsl:choose>
<xsl:when test="/field[starts-with(#name, '__nohtml')]">
text output
</xsl:when>
<xsl:otherwise>
html output
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
But it never sends the email when I use this. I tried just rendering with this template on my own machine and I get errors. And I've also noticed that w3 documentation says the The xsl:output element is only allowed as a top-level element. That probably explains why I can't put it in the element.
I've also tried just completely omitting the element and it seems to default to HTML no matter what.
I've tried searching our local Ektron code for the point where the transformation occurs so I can tell Ektron to use the default XSLT in standard cases or use a different XSLT if __nohtml exists, but I don't know if that code is even accessible.
I would greatly appreciate it if someone can help me find a template that would allow either HTML or plaintext based on whether a field exists. If not then it would be equally awesome if someone could point me to the point of XSLT transformation in Ektron's code (if it's even accessible).
I would recommend a form strategy to generate a version of an email that you build out. There should be a public override void OnAfterSubmit(FormData formData, FormSubmittedData submittedFormData, string formXml, CmsEventArgs eventArgs) that would allow you to create pull out the submitted form data (either in the raw object or I believe it returns the xml as well. From there you could just parse it and save your html file.

Xforms checkbox - replacing True / False with Y / N

I am writing a form (betterFORMs/Xforms) to be displayed to the user with a selection of checkboxes.
If a checkbox is empty the form should bind an "N" into the element. When ticked, a "Y".
I realise there are answers to this question already but I have tried all answered solutions with no luck.
The first solution I attempted to use is here - stackoverflow link
(the first solution looks good, but I have had more success with solution 2 as I am not using Orbeon)
The answer given is what I am looking for, but I am having trouble implementing this into my form. I am not using Xhtml or Orbeon and so the binding I use seems to be different to that used in the solution.) I have tried tweaking this code to fit into my form but I get a repetitive error from the xml parser every time I load the page - but it doesn't point me to anywhere related to the new code.
The next solution I have tried is found here - stackoverflow link
This answer has had the best results in my code because the checkbox values change to N when not used and when they are deselected. The problem I have with this solution is that the Y set in the form element is contained in braces - [].
output example:
<addressProof>N</addressProof><other>[Y]</other><otherText>_text_</otherText>
Here is a snippet of my form:
model:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns="http://www.w3.org/2002/06/xhtml2" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<xsl:output method="xml" />
<xsl:template match="/">
<xforms:model id="documentsChecklist">
<xforms:instance>
<actionform xmlns="">
<xforms:model id="documentsChecklist">
<xforms:instance>
<actionform xmlns="">
<detail>
<other></other>
<otherText></otherText>
</detail>
</actionform>
</xforms:instance>
<xforms:bind id="other" nodeset="/actionform/detail/other" calculate="choose(. = 'Y', ., 'N')"/>
<xforms:bind nodeset="/actionform/detail/otherBox" relevant="/actionform/detail/other ='Y'" />
</xforms:model>
form:
<div id="formBody"><br />
<xforms:select bind="other" appearance="full" align="right">
<xforms:item>
<xforms:label>Other</xforms:label>
<xforms:value>Y</xforms:value>
</xforms:item>
</xforms:select>
<xforms:input ref="/actionform/detail/otherText">
<xforms:label>Please specify:*</xforms:label>
</xforms:input>
</div>
</xsl:template>
</xsl:stylesheet>
Why does the checkbox value now get set to "[Y]" instead of "Y"? (Could it be something to do with an Array?) Thanks.
PS. I know I could do this using a boolean for each checkbox, with the checkbox value corresponding to the boolean, which in turn updates the bind value. I would rather not have to have a big block of boolean elements and binds as I have a large amount of check boxes. this solution has an example here - stackoverflow link
A select control allows you to select more than one item and I wonder if it is why the XForms implementation you are using is adding square brackets (according to specifications selected values have to be separated by a space character, which is not always very convenient by the way).
I am afraid that XForms 1.1 and XForms 2.0 require to use extra intermediate nodes and bindings. It would be useful to be able to add 2 XPath expressions for bindings: one to convert node value to control value and the other one back from control value to node value.
As a workaround, I use another extension in XSLTForms: XSLT stylesheets for converting instances.
-Alain

Unable to Add/Modify Mobile Phone field using IPP against QuickBooks desktop

I can't seem to modify or add the Mobile phone field in QuickBooks for QB Desktop. Online works fine, no dice in desktop but according to the XML response of the MOD request it seems to be working fine.
It shows the field being created/modified (idDomain is created, id value generated) however SyncManager never pushes the changes to QuickBooks.
I can modify the Mobile value on the QB side and I'll be able to see that change in my IPP application but no go when heading the other direction.
Here's the XML traces:
http://pastebin.com/qprwAh9z
Any ideas?
I was able to replicate this. The mobile phone number does not sync to the QB desktop file.Seems like a bug.
Please submit a support ticket here:
Link - http://developer.intuit.com/Support/Incident
It looks like, the problem is when you use 'Mobile' in the Phone's 'Tag' field.
Instead of 'Mobile', I tried 'Home' in the Tag field. As an alternate solution you can try the following (I will take a look if there is any constraint in the intermediate QBXML/QBSDK side )
IDS Req
<?xml version="1.0" encoding="UTF-8"?>
<Add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" RequestId="22f39648c5ab1111988854e808163dc9" xmlns="http://www.intuit.com/sb/cdm/v2">
<ExternalRealmId>657117515</ExternalRealmId>
<Object xsi:type="Customer">
<TypeOf>Person</TypeOf>
<Name>SampleCust-IDS12</Name>
<Address>
...
</Address>
<Address>
...
</Address>
<Phone>
<DeviceType>LandLine</DeviceType>
<FreeFormNumber>0123456789</FreeFormNumber>
<Default>1</Default>
<Tag>Business</Tag>
</Phone>
<Phone>
<DeviceType>LandLine</DeviceType>
<FreeFormNumber>1234567890</FreeFormNumber>
<Default>0</Default>
<Tag>Home</Tag>
</Phone>
...
</Object>
</Add>
Create Response
<RestResponse xmlns="http://www.intuit.com/sb/cdm/v2">
<Success RequestId="22f39648c5ab1111988854e808163dc9">
<PartyRoleRef>
<Id idDomain="NG">1221097</Id>
<SyncToken>1</SyncToken>
<LastUpdatedTime>2013-07-19T11:25:43Z</LastUpdatedTime>
<PartyReferenceId idDomain="NG">1261065</PartyReferenceId>
</PartyRoleRef>
<RequestName>CustomerAdd</RequestName>
<ProcessedTime>2013-07-19T11:25:43Z</ProcessedTime>
</Success>
</RestResponse>
QBXML [ 2nd phone no is coming under AltPhone tag ]
<?qbxml version="9.0" ?>
<QBXML>
<QBXMLMsgsRq onError="continueOnError" newMessageSetID="13ff6ae6e2c76b59e49">
<CustomerAddRq requestID="EsbKeyMapHeader:1221097:0">
<CustomerAdd>
<Name>SampleCust-IDS12</Name>
..
<BillAddress>
...
</BillAddress>
<ShipAddress>
...
</ShipAddress>
<PrintAs>SampleCust</PrintAs>
<Phone>0123456789</Phone>
<AltPhone>1234567890</AltPhone>
<Fax></Fax>
..
</CustomerAddRq>
</QBXMLMsgsRq>
</QBXML>
QB's view [ There is no specific field for Mobile. Mobile/LandLine is kindOf Metadata. I'll check and confirm this behaviour ]
Thanks

Umbraco XSLT RenderTemplate Woes

Needing a little guidance with XSLT and Umbraco. Fairly new to XSLT but I think I understand the concepts. Right on one page I have two columns, each with their own separate pickable content. This is done via the standard content picker property (one for each column). The issue is that I need to be able to have two different templates on the page. So in essence the page navigated two which has the columns has to render two of it's child items in its own page.
I have this working with one column using a generic XSLT which I found that basically just renders what ever child item it finds, but I want it to render what ever one the user picked.
I know the Content Picker returns the XML Node ID of the page and that can be used with the Render Template function to display it (I have an example of that), but when it comes to adding in my own properties and then passing them to the RenderTemplate function I get lost. New to this XSLT :).
So far I have...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon"
xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes"
xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath"
xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions"
xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings"
xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets">
<xsl:output method="html" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:variable name="nodeID" select="data[#alias='leftColumn']"/>
<xsl:template match="/">
<xsl:value-of select="umbraco.library:RenderTemplate($nodeID)" disable-output-escaping="yes"/>
</xsl:template>
</xsl:stylesheet>
Any one know why this doesn't work and how to do what I'm after? The above gives a value was either too large or too small error.
You actually have two problems here ...
Calling RenderTemplate()
RenderTemplate actually requires two arguments when using an alternative template, the first being the content node ID, and the second being the chosen template you want applied.
<xsl:value-of
select="umbraco.library:RenderTemplate($nodeID, $templateID)"
disable-output-escaping="yes" />
See the following link for more information : http://our.umbraco.org/wiki/reference/umbracolibrary/rendertemplate
Too large or too small error
This one is simple to fix by putting an if-empty statement around the the code in question.
<xsl:if test="$nodeID != ''">
<xsl:value-of
select="umbraco.library:RenderTemplate($nodeID, $templateID)"
disable-output-escaping="yes" />
</xsl:if>
The XSLT parser likes to assume certain values are null, when in reality they aren't. Another way to get by this is to check the Skip Errors checkbox when saving, but this makes debugging actual erroneous code a bit of a pain.
Hope it helps.