AxCons,

 

  I looked into this and can’t find a simple way to pull this up.  Unfortunately, the code sections of the validation routines don’t seem to be able to access any variables except modeling variables.  It seems to be coded to for more access from the approval (lower half) form.  If you do find a way of doing this, let me know.

Good luck.

 

Regards,

Tom T.

 


From: Axapta-Knowledge-Village@yahoogroups.com [mailto:Axapta-Knowledge-Village@yahoogroups.com] On Behalf Of Axapta Consultant
Sent: Tuesday, May 24, 2005 12:48 PM
To: Axapta-Knowledge-Village@yahoogroups.com
Subject: RE: [Axapta-Knowledge-Village] Re: Product Builder - Validation

 

Tom

 

Another question if you do not mind. In the scenario I mentioned where I wanted to get payment term from a Cust variable, if I choose to use CustAccount instead of CustName, is there a way I can get the customer account from the sales order?

 

I know if I can write a code node I can get it:

 

select firstonly salesLine

where salesLine.InventTransID == lotId;

    countryId = salesTable::find(salesLine.SalesId).CustAccount;

 

But if I want to get it within the product builder user dialog, I was wondering if there is a way. Obviously I know there is a challenge here as I need a variable to write post validation. So even assuming I have a dummy text field, would it be possible do this from system variable 'Lot Id'? I know you mentioned simple variables are not part of VarMap, I am not sure if System variables are. I tried writing this code on a PreCust (text type)variable, post validation (I did Value 1 and Value 1 to always return) and it didn't work:

 

str 512 ruleexpr(PBAVarMap varMap)

{

SalesLine SalesLine;

InventTransId lotId;

;

 

select firstonly SalesLine

where SalesLine.InventTransID == lotId;

    return SalesTable::find(salesLine.SalesId).CustAccount;

 

}

 

However if I change it to:

 

str 512 ruleexpr(PBAVarMap varMap)

{

SalesLine SalesLine;

;

 

select firstonly SalesLine

where SalesLine.InventTransID == (varMap.Get("PreCust"));

    return SalesTable::find(salesLine.SalesId).CustAccount;

 

}

 and manually enter the Lot id in PreCust it works.

 

Another issue I am facing is, in the second situation is even though I am able to return the CustAccount, it will not return PayTermId (I did change the post validation to search for CustAccount and not Name). I have to again select the customer that is returned for it to work.

 

Any insights? I appreciate all your help.

Thanks - axcons

Axapta Consultant <[EMAIL PROTECTED]> wrote:

Thanks a ton Tom. You are super!

 

Not being a developer myself I have been struggling with this (I can dabble a little bit but I do have my limitations). You saved me a lot of headache. I was going to do a lot of table nodes and code nodes.

 

On the Cust name, I am also not very pleased with using name, but this customer is very particular about using names instead of Accountnum.

 

Excellent!

Thomas Turney <[EMAIL PROTECTED]> wrote:

  You can do this is a similar fashion to what I had described earlier.  In fact you have most of the code you need already.  Do it like this:

 

1.)     From your Cust variable, click on variable validation and give it a name like Get terms.

2.)     Click on the rule button and select post-field validation.  Enter a rule like the one below:

 

 

 

      This will force a true action on every validation.

3.)     Next click action and select action if true.

4.)     Now create a line with the variable as your PayTerm and then click the value button.

5.)     In the value form, change the type from variable to value (allows you to return a direct value) and click the transfer to program code button.

6.)     Lastly, in the code editor make your code like this:

 

     str 512 ruleexpr(PBAVarMap varMap)

     {

       CustTable tableSearchCustTable;

     ;

       select firstonly tableSearchCustTable

             where tableSearchCustTable.Name == varMap.Get("Cust",1);

 

        return tableSearchCustTable.PaymTermId;

     }

     

      This should take care of it.  The only problem I see is that using a field that is not unique (customer name) you are only going to pull up the first customer with that name.  The customer id field would be a better choice.  Good luck.

 

Regards,

Tom T.

 

 


From: Axapta-Knowledge-Village@yahoogroups.com [mailto:Axapta-Knowledge-Village@yahoogroups.com] On Behalf Of Axapta Consultant
Sent: Monday, May 23, 2005 11:10 PM
To: Axapta-Knowledge-Village@yahoogroups.com
Subject: RE: [Axapta-Knowledge-Village] Re: Product Builder - Validation

 

Tom

 

I had posted a product builder question before and I didn't get any response. I would appreciate if you have any insight. I had posted the question after I saw your response to a question in Technet (thread 12055). I am posting the question again. I would appreciate any help you can provide. Thanks

 

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: Axapta-Knowledge-Village@yahoogroups.com
[mailto:Axapta-Knowledge-Village@yahoogroups.com] On Behalf Of tsk1958pete
Sent: Monday, May 23, 2005 5:32 PM
To: Axapta-Knowledge-Village@yahoogroups.com
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 Axapta-Knowledge-Village@yahoogroups.com, "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: Axapta-Knowledge-Village@yahoogroups.com
> [mailto:Axapta-Knowledge-Village@yahoogroups.com] On Behalf Of
tsk1958pete
> Sent: Monday, May 23, 2005 11:36 AM
> To: Axapta-Knowledge-Village@yahoogroups.com
> 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.



Sharing the knowledge on Axapta.


Do You Yahoo!?
Yahoo! Small Business - Try our new Resources site!

Sharing the knowledge on Axapta.


Do You Yahoo!?
Yahoo! Small Business - Try our new Resources site!

Sharing the knowledge on Axapta.




Sharing the knowledge on Axapta.



Yahoo! Groups Links

Reply via email to