Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Manufacturing & Supply Chain

User login

Frontpage Sponsor

Main

Poll
As a Customer What would do to keep your ERP Implementation intact
Proactively define Business Process-- Take the Project Ownership
50%
Handover everything to System Integrator from drawing BP till implementation of ERP
0%
Hire more inhouse skilled & capable IT Resource to work directly with SI
50%
Rely on SI Architects/Consultants
0%
Total votes: 4

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 30th August 2002, 17:00
fosterjr's Avatar
fosterjr fosterjr is offline
Member
 
Join Date: Aug 2001
Location: Danbury, CT, USA
Posts: 79
fosterjr is on a distinguished road
Baan: BaanIVc3,Ivc4 - DB: Oracle 9i, SQLServer 2000 - OS: HP-UX 11i, MSWindows
Product Configurator Constraints w/ 4gl

Could anyone provide me or post examples of product configurator constraints (BaanIVc4) that utilize 4gl commands?

I am especially interested in any that include sql with a validate = true or validate = false in the selectdo or selectempty segments of the sql code.

Thanks,

Jason Foster
Kendro Laboratory Products
Reply With Quote
  #2  
Old 3rd September 2002, 12:11
Andreas's Avatar
Andreas Andreas is offline
Senior Member
 
Join Date: Nov 2001
Location: Hannover
Posts: 263
Andreas is on a distinguished road
Baan: ERP LN FP5 - DB: Oracle 10g - OS: AIX, SLES
Hi Jason,

i'm on 5c but it should work similar in IVc.
Be sure to use object Version of pcf.

In the Constraint you can not use 4 GL commands because after compiling your constraints work like functions in a dll and there is no GUI. But you can use nearly all 3 GL commands.
For your question it is very easy.
Just declare your desired tables and do a select statement similar to this:

table ttppp999

select ttppp999.*
from ttppp999
where .....
selectdo
validate = true
selectempty
validate = false
endselect



hope this helps
Reply With Quote
  #3  
Old 3rd September 2002, 22:54
p.cole's Avatar
p.cole p.cole is offline
Senior Member
 
Join Date: Nov 2001
Location: Portsmouth, UK
Posts: 265
p.cole is on a distinguished road
Baan: Baan IVc4 SP20, ERP LN FP3 - DB: MSSQL 2005 - OS: W2K3
The code above is perfectly correct... except that every line that is 3GL needs an exclamation mark (!) in the first column. e.g

!table ttppp999

!select ttppp999.*
!from ttppp999
!where .....
!selectdo
validate = true
!selectempty
validate = false
!endselect

BTW, validate is normally true in validation constraints so you can simplify the above. Also changing "validation" to "V" in the PCF parameters will save your fingers!!
Reply With Quote
  #4  
Old 5th September 2002, 13:31
Andreas's Avatar
Andreas Andreas is offline
Senior Member
 
Join Date: Nov 2001
Location: Hannover
Posts: 263
Andreas is on a distinguished road
Baan: ERP LN FP5 - DB: Oracle 10g - OS: AIX, SLES
Thanks for hints,
but in 5c you don't need exclamation marks.
It works like posted before.
Don't know if its different in Baan IV
Reply With Quote
  #5  
Old 5th September 2002, 14:05
fosterjr's Avatar
fosterjr fosterjr is offline
Member
 
Join Date: Aug 2001
Location: Danbury, CT, USA
Posts: 79
fosterjr is on a distinguished road
Baan: BaanIVc3,Ivc4 - DB: Oracle 9i, SQLServer 2000 - OS: HP-UX 11i, MSWindows
Thanks for all the help. Here is a few things I have learned:

1. 5c does not need the exclamation marks. IVc does.

2. Sometimes Baan Support does an excellent job. Here are some examples of IVc constraints using 4gl:

Examples of how to use the Baan 3GL/4GL language in PCF constraints are shown below.
Example 1:
Suppose you want to fill the 'Reference B' field of a sales order with the value of the feature [special]. This can only be done when generating a product variant structure for this sales order, not when configuring the variant. The most probable place to locate this code is in the Parameter Substitution section of e.g. a BOM constraint. (Think of Parameter Substitution as the constraint section where information from the constraints is written to the database tables.) This is done with 3GL statements. Every 3GL statement is preceded by an exclamation mark.
! table ttdsls040 declare every table you want to use
long orno declare local variables
! import ("tdsls040.orno", orno) import order number
tdsls040.orno = orno key of record you want to select
! tdsls040.orno = shiftr$ (tdsls040.orno) right adjustment (if necessary)
! db.eq (ttdsls040, db.lock) select record and lock it
(lock for write operations)
if not e then
tdsls040.refb = [special] assign feature value to table field
! db.update (ttdsls040) update table in memory
! commit.transaction ( ) write table and remove lock
endif

Example 2:
Suppose you want to read the latest purchase price of a generic purchased item in a constraint and assign it to the feature [price] or to the system variable 'price', then you could use a very simple constraint like this:
! table ttiitm001
! [price] = tiitm001.1tpr (validation section of product feature constraint)
! price = tiitm001.1tpr (parameter substitution section of generic price list constraint)
In this case you don't have to select the generic item record, since the field you want to read is one of the current record (the current generic item).

Example 3:
Suppose you want to limit the option set of the feature [color], based on the customer number. Usually you would solve this problem by creating a feature [cust] or something, and use the value of this feature in the validation section of the constraint for the feature [color], like this:
if [cust] = "2024" then
c: [color] is ("red", "green", "magenta")
else
if [cust] = ".......
This is a tremendous amount of work if you have many customers. Using 3GL statements can save a lot of work. The first thing you have to do is create a new table, for example, "tipcf900", containing the options per customer. Or, if there is more than one feature that is dependent on the customer number, the feature options per customer. Such a table might look like this:
Record 1 Record 2 Record 3 Record 4 Record 5 Record 6
cuno 2024 2024 2024 2024 2024 2031
cpft color color color color color color
copt red green blue normal large blue

A separate Baan session would need to be created to maintain this table. Once the maintenance session and the table are defined, the table can be used in the aforementioned validation section, like this:
! table ttipcf900 declare table
! import ("tipcf500.cuno", tipcf900.cuno) get customer number from variant
tipcf900.cpft = " color" select feature
tipcf900.copt = [color] manipulate the option set of the feature
! db.eq (tipcf900) select all options with these keys
if not e then
validate = false validate the selected records
endif



Example 4:
Suppose you want to use a constraint to insert an item into the customized BOM during the generation stage rather than entering a large number of components with the same sequence number into the Generic BOM and writing a validation constraint for each component. This would drastically reduce Generic BOM maintenance and constraint coding while speeding up constraint processing (due to fewer generic BOM lines and constraints).
This requires the definiton of a DUMMY component in the Generic BOM. The idea is that you want to replace the item DUMMY with a standard item depending on the selected options. Technically it is a little difficult to replace DUMMY, because that means that you have to manipulate the customized BOM after it has been generated. What you can do however, is set "VALIDATE = FALSE" for the component DUMMY and immediately insert a new customized BOM line. That is done as follows:
! table ttipcs022 | # Customized BOM lines
! table ttipcf500 | # Product Variant ID's

| # to add a new record to ttipcs022, first fill the key fields
! import ("tipcf500.refo", tipcs022.cprj) | # Project (from variant)
! import ("tipcf500.item", tipcs022.mitm) | # Top item
tipcs022.pono = 10 | # BOM line position

| # now fill the other fields of the record
tipcs022.sitm = ................ | # the item code
! tipcs022.opol = toittb.standard | # standard item
tipcs022.qana = ............... | # net quantity
tipcs022.cwar = ... | # warehouse
! tipcs022.cpha = tcyesno.no | # not a phantom
| # now add the new record to the table and don't validate DUMMY
! db.insert (ttipcs022)
! commit.transaction ( )
validate = false
That's it. Of course this will only work when you configure a variant for a project, because the project number was read from the variant. You can probably also import tipcs020.cprj.


Example 5:
This constraint reads the order number from the pcf table and uses it to read the customer code for prices and discounts from the sales order header (form 2). It was written in the Before Input section for the feature [cust].

! table ttdsls040 | Declare sales order header table;
| No need to declare pcf500 since it
| is already active
string orno | Declare variable to store order #
! import("tipcf500.refo", orno) | Read order # from pcf500

! tdsls040.orno = val(orno) | Convert order # into a numeric
| value & set key field in sales
| order header table
! db.eq(ttdsls040) |Select sales order header record
[cust] = tdsls040.pcpr | Populate [cust] feature with value
| from customer price & statistics
| field
Example 6:
|This constraint uses the weight information from the parent item
|along with calculations based on the selected features to calculate
|the weight of the customized item. The resulting weight is written
|to the customized item record.
!table ttipcs022
!table ttipcs021
double weight

!import ("tipcs022.cprj", tipcs021.cprj)
!import ("tipcs022.mitm", tipcs021.item)
!db.eq (ttipcs021, db.lock)

if not e then
weight = tipcs021.wght
weight = weight + 1.35
tipcs021.wght = weight
! db.update (ttipcs021)
! commit transaction()
endif
Example 7
Here is a very useful 4GL constraint
it will lookup the estimated cost for a customized item which can then be used in the generic pricing: (Note: you need to generate the product structure can calculate project costs before you can calculate the sales price structure)
!table ttipcf500
!table ttipcs021
!import ("tipcf500.item",tipcf500.item)
!import ("tipcf500.refo",tipcf500.refo)

!select tipcs021.cpre
!from tipcs021
!where tipcs021.cprj = :tipcf500.refo
! and tipcs021.item = :tipcf500.item
!selectdo
price = tipcs021.cpre
!endselect

!selectdo
price = tipcs021.cpre
!endselect
Reply With Quote
  #6  
Old 3rd May 2013, 19:33
Tomas Toth Tomas Toth is offline
Member
 
Join Date: Aug 2011
Posts: 36
Tomas Toth is on a distinguished road
Baan: BAAN IV - DB: BAAN IV - OS: WIN 7
Hello
Please could you advice if I can exchange the Supplier (suno) for an item to the table tipcs021 during my generating phase ? Depending on the Configuration I should place the Purchase order on different supplier. Is this possible in Baan IV ?
Reply With Quote
  #7  
Old 20th January 2014, 12:32
Tomas Toth Tomas Toth is offline
Member
 
Join Date: Aug 2011
Posts: 36
Tomas Toth is on a distinguished road
Baan: BAAN IV - DB: BAAN IV - OS: WIN 7
Hello
Has someone tried the "Example7" to calculate the sales price from the Estimated Cost from the Project, when generating the Product Variant Structure For Sales order ?
Thanks
regards
Tomas
Reply With Quote
Sponsored Links
  #8  
Old 16th January 2015, 07:12
jeffersyuan jeffersyuan is offline
Senior Member
 
Join Date: Jan 2006
Posts: 286
jeffersyuan is on a distinguished road
Baan: B4,B50C, LN FP1-FP10 - DB: SQL Server , Oracle - OS: Window , Unix , AIX
Did somebody tried the example 3?

I mean, it seems 'c:' does not works, and what does the 'c:' means?

Thanks.
__________________
The Simply is The Best
Reply With Quote
  #9  
Old 20th January 2015, 13:19
Tomas Toth Tomas Toth is offline
Member
 
Join Date: Aug 2011
Posts: 36
Tomas Toth is on a distinguished road
Baan: BAAN IV - DB: BAAN IV - OS: WIN 7
function "c:" works fine in PCF constraint, validation section.
This allowes to only state the option that you want to have for certain condition in the formula. I use it, when I want some option to be valid and also blank. like:
if [feature1] = "condition" then
c: [feature2] is {"","option"}
endif
because when you define the option list within the feature, you cannot even have "blank"
Reply With Quote
  #10  
Old 29th January 2015, 11:49
jeffersyuan jeffersyuan is offline
Senior Member
 
Join Date: Jan 2006
Posts: 286
jeffersyuan is on a distinguished road
Baan: B4,B50C, LN FP1-FP10 - DB: SQL Server , Oracle - OS: Window , Unix , AIX
Hi, Tomas,

That's really stranger.
When I created a Validation or Before Input or Parameter Subsitution types constraints.

I pasted the following code:
[F01] and [F02] are the features, an "1T", "2T" as the options of [F02]

if [F01]="8G" then
c:[F02] is {"1T","2T"}
else
c:[F02] is {"1T","2T"}
endif

However, when I check the constrain. It always give me the error as:

Check constraint GEN-008(Validation).

Domain expression not allowed (line 2).
c:[F02] is {"1T","2T"}

Any ideas on it?

Jeffers
--------------------------------------------------------------------------------

Quote:
Originally Posted by Tomas Toth View Post
function "c:" works fine in PCF constraint, validation section.
This allowes to only state the option that you want to have for certain condition in the formula. I use it, when I want some option to be valid and also blank. like:
if [feature1] = "condition" then
c: [feature2] is {"","option"}
endif
because when you define the option list within the feature, you cannot even have "blank"
__________________
The Simply is The Best
Reply With Quote
  #11  
Old 29th January 2015, 13:21
Juergen's Avatar
Juergen Juergen is offline
Guru
 
Join Date: Aug 2001
Location: Germany
Posts: 600
Juergen is on a distinguished road
Baan: IVc4, ERPLN - DB: Oracle - OS: Linux, Windows
Hi Jeffers,

unfortunaterly it's a long time ago where I was involved in that PCF stuff, but remember that we had also sometimes that kind of errors when using the Interpreter Version instead of the Object Version.

So if you are using the Interpreter Version maybe it's possible on the test system to switch to the Object Version for some testing.

Regards,
Juergen
Reply With Quote
  #12  
Old 29th January 2015, 14:03
jeffersyuan jeffersyuan is offline
Senior Member
 
Join Date: Jan 2006
Posts: 286
jeffersyuan is on a distinguished road
Baan: B4,B50C, LN FP1-FP10 - DB: SQL Server , Oracle - OS: Window , Unix , AIX
Hi, Juergen,

Thanks a for your reply, however, in my test enviroment, I am already using the object version.
That had already confusing me for a long time.
And the Infor guy told me, they donot support the constrains programing,

Jeffers




Quote:
Originally Posted by Juergen View Post
Hi Jeffers,

unfortunaterly it's a long time ago where I was involved in that PCF stuff, but remember that we had also sometimes that kind of errors when using the Interpreter Version instead of the Object Version.

So if you are using the Interpreter Version maybe it's possible on the test system to switch to the Object Version for some testing.

Regards,
Juergen
__________________
The Simply is The Best
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Baan 4GL, to the open source Eclipse environment for ERP-LN. baanow General Discussion & Chat 1 5th October 2004 09:52
Cash Sales And Product Scenarios in BaaN Abuibra Distribution, Transportation & Warehousing 1 19th July 2003 03:47


All times are GMT +2. The time now is 18:56.


©2001-2018 - Baanboard.com - Baanforums.com