Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / August 2005

Tip: Looking for answers? Try searching our database.

calculating a formula with cell from XML file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Katayon - 21 Jul 2005 20:45 GMT
I have a textbox which I would like to show the result of a particular
calculation.
The calculation should include a value from a cell in an XML file which has
been included as a secondary data connection.

In the properties of the textbox, I select the f(x) option to create a
forumla, from there I click "Insert Field or Group" and then I access the
secondary data connection.  I expand all the folders, however I am not able
to see a list of cells.

How can I specify a particular cell value from an XML file to be used in the
forumla?

(perhaps does my xml file have to formated a particular way?)

Thank you,
Katayon
Scott L. Heim [MSFT] - 22 Jul 2005 22:08 GMT
Hi Katayon,

I am able to get this to work as you need using an XML file setup as
follows:

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <nums>
        <nextnum>71</nextnum>
    </nums>
</root>

Now I had created this for another sample so the node names are probably
odd for this scenario but when I add this as a data source, I can use the
"nextnum" node in the formula for my text box and the calculation works as
expected.

I hope this helps!

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights
Katayon - 23 Jul 2005 01:50 GMT
Hi Scott,

Thanks for the response.  This particular issue has really stoped my work on
the file and I have not been able to find the solution anywhere and it's very
important that I get it resolved right away.

I am not sure I understand your suggestion below, and please bare with me.  
My XML file is actually just an excel spreadsheet that I saved as an XML file
in order to be able to use it as a data connection in the InfoPath file.  The
simple spreadsheet just has items and a price grid.  

I would like the Infopath document to use particular cell values to
calculate with in a formula.  I am not sure from your suggestion below how I
can incorporate the code in the XML file and get the InfoPath file to look at
the cell number (i.e. C5) and it's value (i.e. 56) that I specifiy in the
forumla.  I think you are suggesting that this needs to be programmed using
VBA editor in the XML file?

Thanks again for your help!

Katayon

> Hi Katayon,
>
[quoted text clipped - 19 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights
Scott L. Heim [MSFT] - 25 Jul 2005 13:19 GMT
Hi Katayon,

In order to use your file, InfoPath must interpret the file as "XML Nodes."
There is no way for it to recognize "cells" like you would see in Excel.

Now, I have not attempted to take an Excel file and save this as an XML
file for use in InfoPath so I am unsure of what the result would be;
however, the sample I provided in my last post does not use custom script
whatsoever - I simply added an expression as the "default value" for my
text box. (If you notice, a text box has a Default Value property and there
is an "expression builder" button next to this property...this is what I
used.)

I hope this helps!

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights
Katayon - 01 Aug 2005 22:17 GMT
I finally figured it out! Thanks for your help!

> Hi Katayon,
>
[quoted text clipped - 15 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.