Hi All , Could any one tell me how exactly %select and %bind works while coming to an AE Program , I read in many forums about these like %select - used to populate the state record %bind is used to get the value from state record ,, what it exactly mean ? %select (name it self bit confusing , as general assumption getting data from DB or State Record) .
Thanks In Advance
As you may know every Application Engines should have at least one State Record.
This is used by the application engine as, if I may call it like that, a placeholder for values across the application engine steps.
The %select is used to select/write data to the state record in SQL/DoSelect steps.
SELECT 'Y' FROM PS_INSTALLATION
This would set the value 'Y' in the staterecord MY_STATEREC_AET in field MY_FIELD
In PeopleCode steps you can assign the value directly without %select
MY_STATEREC_AET.MY_FIELD = "Y";
The %bind is there to retrieve values from the state record and to be used in SQL steps
SET COLUMN = %BIND(MY_STATEREC_AET.MY_FIELD)
For more details on this please read PeopleBooks on Application Engines
Hope this clarifies your question.
Hi Haken , here my_field has to be there in state record ? we need to put it manually ? What I understood is you need to take all the fields initially in to the state record then need to apply %select (field1,field2........) ,, What happens if the data type does not matches in b/w them ?
I think you haven't fully understood the principle.
The state record is a container that you can use to values and use this values over steps and actions, you do not have to use it.
It is useful of storing the return values of SELECT statement and reuse these value in other steps and actions of your AE.
What happens if the data type does not matches in b/w them ?
You are the one that is writing code to add values to the state record, so you should know if the data types match.