A
Adam Harding
Imagine i have a purchase order form which is linked to a secondary data
source supplying the goods that can be purchased, quantities in stock and
price per item.
Primary Data Source
Repeating
@ItemName, @ItemPrice, @ItemQty, @LineCost
Secondary Data Source
@ProductName, @ProductPrice
the customer fills out the order by selecting an item form the drop-down
list @ProductName and inputting the quantity required in text box @ItemQty.
Using rules i set the @ItemPrice value relative to the name of the product
from the secondary data source ie where @ItemName = @ProductName. Then i
autocalculate the @LineCost by multiplying @ItemPrice by @ItemQty.
PROBLEM
The rule to set the price works fine for the first line of the repeating
table but falls down on subsequent lines if the @ProductPrice value is larger
than the first line, in which case it defaults to the first line's value for
@ItemPrice. If the @ProductPrice is lower it will work fine, but only as
long as on each subsequent line the @ItemPrice is lower or equal to the lines
above.
SOLUTION
The current() function has no impact in helping solve this rule but after a
year of trying i have worked a way around it. GET THE USER TO SELECT THE
PRICE FILTERED BY THE SAME CRITERIA. Change the @ItemPrice field to a
drop-down list box and validate it not to be blank. Supply the price list
from the secondary data source list @ProductPrice but filter it where
@ItemName = @ProductName which means there is only one item in the list, THE
CORRECT PRICE.
ANALYSIS
I cannot help but feel that the automatic rule only populating values lower
than the first harks back to filtering in Excel and ordering. This presents
a massive problem to proper development of infopath as a forms tool where it
cannot through its own rules satisfy this not very demanding criteria.
Can anyone think of a simple way to get around this?
Cheers Adam
source supplying the goods that can be purchased, quantities in stock and
price per item.
Primary Data Source
Repeating
@ItemName, @ItemPrice, @ItemQty, @LineCost
Secondary Data Source
@ProductName, @ProductPrice
the customer fills out the order by selecting an item form the drop-down
list @ProductName and inputting the quantity required in text box @ItemQty.
Using rules i set the @ItemPrice value relative to the name of the product
from the secondary data source ie where @ItemName = @ProductName. Then i
autocalculate the @LineCost by multiplying @ItemPrice by @ItemQty.
PROBLEM
The rule to set the price works fine for the first line of the repeating
table but falls down on subsequent lines if the @ProductPrice value is larger
than the first line, in which case it defaults to the first line's value for
@ItemPrice. If the @ProductPrice is lower it will work fine, but only as
long as on each subsequent line the @ItemPrice is lower or equal to the lines
above.
SOLUTION
The current() function has no impact in helping solve this rule but after a
year of trying i have worked a way around it. GET THE USER TO SELECT THE
PRICE FILTERED BY THE SAME CRITERIA. Change the @ItemPrice field to a
drop-down list box and validate it not to be blank. Supply the price list
from the secondary data source list @ProductPrice but filter it where
@ItemName = @ProductName which means there is only one item in the list, THE
CORRECT PRICE.
ANALYSIS
I cannot help but feel that the automatic rule only populating values lower
than the first harks back to filtering in Excel and ordering. This presents
a massive problem to proper development of infopath as a forms tool where it
cannot through its own rules satisfy this not very demanding criteria.
Can anyone think of a simple way to get around this?
Cheers Adam