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 / May 2006

Tip: Looking for answers? Try searching our database.

So Close (current funciton and repeating tables i think)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Shaun - 09 May 2006 20:45 GMT
Before I ask what I hope it my final question, I want to say thanks for all
the help. This is my first infopath project and it is a little ambitious for
a first attempt. I've gotten everything working with one exception. Here is
the problem, i was hoping someone could help me. I'm pretty sure I should be
using the current function somehow but i don't really know how.

I have a repeating table that has a nested repeating table inside of it. I
want to set the default value of a textbox inside this nested repeating table
to a value obtained via a function that operates on a secondary datasource. I
want to count all the rows in this seconday datasource only if a field in the
seconday datasource = a field in this nested repeating table. For some
reason, it doesn't seem to work using the point-click method of building a
default value; it just repeats the same value on every textbox.

Should I be using the current function somehow? I've read some other posts
on using the current function and i don't understand how to use it if i want
to count instances in a seconday datastore, filtered via a comparrison
between a value in the repeating table and the value in that secondary data
store.

Thanks again.
Shaun - 09 May 2006 20:50 GMT
just for further info. The XPATH of what i'm trying to do using the
point-click method is:

count(xdXDocument:GetDOM("Vehicles")/dfs:myFields/dfs:dataFields/d:Vehicles/d:radioVeh[@radioSystem
=
xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/d:comSystemList/d:Systems/@TOC_System])

and my version with my non-working usage of current is:
count(xdXDocument:GetDOM("Vehicles")/dfs:myFields/dfs:dataFields/d:Vehicles/d:radioVeh[@radioSystem = current()/my:TOC_System])

see, i think with the first version it is simply using the first instance in
the repeating table vs. the actual current one. My attempt at using the
current() function doesn't work but that's what i'm trying to do.
Adam Harding - 11 May 2006 09:01 GMT
Shaun

you will have to experiment moving further up the data tree after the equals
sign.

EG

count(xdXDocument:GetDOM("Vehicles")/dfs:myFields/dfs:dataFields/d:Vehicles/d:radioVeh[@radioSystem = current()/@TOC_System])

OR

count(xdXDocument:GetDOM("Vehicles")/dfs:myFields/dfs:dataFields/d:Vehicles/d:radioVeh[@radioSystem = current()/d:systems/TOC_System])

And so on

At one point it will work and I THINK it is around the /d:comSystemList bit
but it is all a bit hazy.  ONE of them will suddenly work and it is amazing
when it does, looks VERY slick.

Cheers Adam

> just for further info. The XPATH of what i'm trying to do using the
> point-click method is:
[quoted text clipped - 9 lines]
> the repeating table vs. the actual current one. My attempt at using the
> current() function doesn't work but that's what i'm trying to do.
Shaun - 11 May 2006 17:18 GMT
This isn't working, I guess i'm in over my head but this has to easy and i'm
just missing something so let me try asking it a different way.

In my repeating table I have a value (../@TOC_System) and I want to count
the rows in a secondary datastore where the key = that value. When I try and
count off the secondary datastore I guess it tried to look at only the first
../@TOC_System instead of the current rows ../@TOC_System. I've tried every
usage of the current() function that I can think of but I can't even get it
to return anything.

> Shaun
>
[quoted text clipped - 30 lines]
> > the repeating table vs. the actual current one. My attempt at using the
> > current() function doesn't work but that's what i'm trying to do.
Shaun - 11 May 2006 18:16 GMT
Just to further help. I'm trying this xpath

count(xdXDocument:GetDOM("Vehicles")/dfs:myFields/dfs:dataFields/d:Vehicles/d:radioVeh[(../@BN_ID
= xdXDocument:get-DOM()/dfs:myFields/dfs:queryFields/q:Systems/@BN_ID) and
(current()/dfs:myFields/dfs:dataFields/d:comSystemList/d:Systems/@TOC_System
= @radioSystem)])

and i've moved that current() all the way down with no results, always
completely blank. I tried to do some debuging and tried to set the field to
(current()/dfs:myFields/dfs:dataFields/d:comSystemList/d:Systems/@TOC_System)
and removing each of the folders one-by-one and it will never display
anything.

The original point-click query was:
count(xdXDocument:GetDOM("Vehicles")/dfs:myFields/dfs:dataFields/d:Vehicles/d:radioVeh[(../@BN_ID
= xdXDocument:get-DOM()/dfs:myFields/dfs:queryFields/q:Systems/@BN_ID) and
(@radioSystem =
xdXDocument:get-DOM()/dfs:myFields/dfs:dataFields/d:comSystemList/d:Systems/@TOC_System)])

I know i'm close but I just can't get there.

Shaun
Greg Collins [InfoPath MVP] - 12 May 2006 00:07 GMT
current() doesn't work the way you are trying to use it.

It can be very difficult at time to understand where current() actually places you in your XPath hierrarchy. But to use it as a root node, as in your first example, is just an invalid use.

I know this isn't fun, but you'll need to identify just which node in your schema structure that current() represents in your scenario. Then you build your XPath from current() in terms of that actual node it represents.

So, if current() represented d:Systems then all you would need is current()/@TOC_System.

Make sense?

Signature

Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Visit InfoPath Dev ( http://www.InfoPathDev.com )

Shaun - 12 May 2006 01:38 GMT
Thank you for your help. I understand what you are saying. to try and debug,
I 'walked' the current down the tree but it was always blank. then I decided
to try and just get it to display where it was so I did a name(current()) and
it reported the name of the textboz the function was in, not even close to
what I was shooting for. 3hen I tried getting to the 'parent' node but based
on the xpath examples I could find that wasn't working either. I just don't
understand why when I just do a ../@Toc_system it gets it right but then when
I try and use that in a filter on a secondary datastore it just refers to the
first entry. how can I refer to the current repeated row? thanks for your
patience; i'm learning quite a bit.
 
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.