Is there a way I can populate a variable from a field in a table that's based on a selection in another table variable?
Here's what I am looking for:
Variable Cust - It is a table variable, lookup field is CustName
Variable PayTerm - It is a text variable.
What I am looking to do is populate PayTerm from field PaymTermId in CustTable for the customer selected in Cust variable (based on CustName)
Thread 12055 in technet (your response) talks about how to calculate a variable, for example if there are variables V1 and V2 and you want V1 = 2 x v1, you could do that by creating a post field validation on V1 and for value for V2 write this code:
real ruleexpr(PBAVarMap varMap)
{
return (varMap.Get("V1")*2)
}
I know I can do what I want in a Table node which basically writes a piece of code as:
select firstonly tableSearchCustTable
where tableSearchCustTable.Name == Cust;
PayTerm= tableSearchCustTable.PaymTermId;
However this code executes after entering all variables and upon configuring and I would see it only in product model approval form. I would like to do this as soon as I select a value in Cust variable similar to how you can calculate V2 based on V1 in the example above.
I would appreciate any help
Thanks
Thomas Turney <[EMAIL PROTECTED]> wrote:
Tim,
If you have a modeling variable for the angle size, say AngleSize, you can
create a validation routine for this like this:
1.) Create a validation of the AngleSize variable, click on the rule button
and select post-field validation rule.
2.) Since you want to force a validation every time this field is changed,
make the first line of the rule a value and the text 1. Insert the next
line above and again make it a value, the text 1 and the operation "=".
This will cause a true value.
3.) Click on the action button and select true. Click new to create a new
line. In the variable column, select the variable you want to return.
After that, click on the value button.
4.) Click on the transfer to code button to work with the code editor.
Assuming for the following the AngleSize variable is the ItemId code of the
inventtable, In the code editor do something like this:
str 512 ruleexpr(PBAVarMap varMap)
{
Return InventTable::Find(varMap.Get("AngleSize")).FieldToReturn;
}
Substitute FieldToReturn with the table variable you want to use (the above
is returning a string).
Regards,
Tom T.
-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of tsk1958pete
Sent: Monday, May 23, 2005 5:32 PM
To: [email protected]
Subject: [Axapta-Knowledge-Village] Re: Product Builder - Validation
Tom,
Thanks again for a timely reply! I'm starting to get the impression
that product builder is adiquate to "configure/build" product
specifications.
I'm running out of ideas here...
My company makes circles from various angle iron sections, based
on the size of the angle, the smallest diameter varies and I need
to validate the size against a table of angle size high and low.
I can set a modeling variable of a table type and refer it to this
table, when the user enters selects the InventID for the angle size,
how can I make the modeling var lookup the appropriate record in the
table and use the value to validate the diameter entered by the user?
I would appreciate ANY help anyone can give me
Tim Peterson
Frustrated Axapta Newbie
--- In [email protected], "Thomas Turney"
<[EMAIL PROTECTED]> wrote:
> Tim,
>
> Unfortunately, I don't believe you can do this using simple
variables.
> They are only directly addressable in tree section (lower) of the
product
> model. They are not part of the varMap.
>
> Tom T.
>
> -----Original Message-----
> From: [email protected]
> [mailto:[EMAIL PROTECTED] On Behalf Of
tsk1958pete
> Sent: Monday, May 23, 2005 11:36 AM
> To: [email protected]
> Subject: [Axapta-Knowledge-Village] Product Builder - Validation
>
> Hello,
>
> When validating in PB how do can I use the value of a "Simple"
> var to validate against?
>
> I.E.
> Simple var text - "simpColor" (Default Value = Blue)
>
> Modeling var text "input"
> Modeling var enum "color" (Outcomes=Blue/Green/Red)
>
> For user input "Blue" in input post validate against the
> default value of simple var "simpColor"
>
> if "input" == "simpColor" Then....
>
> I assume i can accomplish this can't I?
>
> Thanks,
> Tim Peterson
>
>
>
>
>
>
>
>
>
> Sharing the knowledge on Axapta.
> Yahoo! Groups Links
Sharing the knowledge on Axapta.
Yahoo! Groups Links
Sharing the knowledge on Axapta.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Sharing the knowledge on Axapta.
Yahoo! Groups Links
http://groups.yahoo.com/group/Axapta-Knowledge-Village/
[EMAIL PROTECTED]

