Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic view in Peoplecode 4

Status
Not open for further replies.

chinu

Programmer
Oct 16, 2001
5
0
0
IN
How can i create a record as dynamic view in peopecode and how can i pass run-time parameters to it from peoplecode events??

it would help if someone can provide me with an example of such a view and also the syntax of passing parameters to it during run-time.

you can also provide me with useful URLs on this subject.
 
Let me ask you, do you want to create a dynamic view using peoplecode or you want to use peoplecode in a dynamic view? And what parameters you want to apply to the dynamic view?

If you have answers for these Qs perhaps I may be able to help you.
 
I'm also looking to do something similar. My main interest is to create a dynamic view that I can pass a parameter at runtime in order to limit the results that are returned. The reason for doing this is that I have a Drop-Down box that I wish to dynamically populate at run time. I was hoping I could pass in a variable to the dynamic view in PeopleCode and use that variable in the WHERE clause of the Dynamic view. I then would have the Prompt Table value for my drop down box's prompt table set to this view.
How can I do this? Have you figured this out? If you have some example code of doing so that would be extremely helpful.

Thanks,
Ryan
 
I'm not sure I get your need right but let me get a shot at it. I just worked on a panel this week where I wanted to prompt on the COMPANY field of a custom record (N_COMP_FUS_TBL). If a row already exists for that company, prompt on it, else I want it to prompt on a view of available companies.

On the SearchInit I've put this:

If %Mode = "A" Then
DERIVED.RECNAME_EDIT = "N_FUS_COMP_VW";
Else
DERIVED.RECNAME_EDIT = "N_COMP_FUS_TBL";
End-If;

Then in the Record Field Properties of that field, set the Prompt Table to %RECNAME_EDIT.

You obviously need the derived field on that panel.

This way at runtime, the prompt table can change depending of the access mode. The view is not actually dynamic, but you can choose at runtime what Prompt Table to use. Maybe it's not exactly what you need, but by playing around with that RECNAME_EDIT (you can look it up in PeopleBooks) you might find a way to get what you want.

HTH.

Hugo.
 
I've figured out how to assign the prompt table dynamically like you have shown. That works just fine. However, I need to make the View that I set the prompt table to at run time somehow accept a parameter to limit the view based on a value that I only know at runtime. I've found that when setting prompt tables it has to be a SQL Table or SQL View and can't be anything else. Thus, I've been trying to find a way to somehow load the View and pass it a parameter if that is even possible so that I get the right set of data at runtime. And then assign the view as the prompt table. From what I've seen this isn't possibly. Thus it is not possible to dynamically fill a dropdown list or create a prompt table based on values found at runtime.
Please correct me if I'm wrong on this.

Thanks,
Ryan
 
Cool stuff HugoBerg! I'll have to try this some day.

I don't think it's possible to dynamically affect the contents of your drop down box (unless you are really gifted with Windows API calls). The prompt table on the other hand provides you with that functionality all ready. For example, in our shop we need to send out group numbers to our health carrier for each individual. We customized the health benefit panel to include a prompt edit box for the group number. Of course each health carrier has their own set of group numbers so we had to make only the correct number available in the prompt. The group number lives on the provider table so we made sure that provider id (primary key on the provider table) appeared on the panel. Once this was done, PeopleTools had everything it needed to limit the data in the prompt edit box.

Now changing the view that's refered to in the record defn on the fly is going to add a fun little twist. Don't know if this will still work.

Rekclaw
 
ryanc,

Prompt tables are enabled to dynamically filter the rows at runtime. Your prompt table must have composite keys. The higher-level key(s) would build criteria matching on your prompt table. The last Key in the record field order is the field that is being returned to the panel field.

Let's say you have a field FIELD1 with a prompt to VIEW1. VIEW1 contains the keys VFIELD1, AND VFIELD2 (in this order). VFIELD2 is the value returned to FIELD1 when you select a row in the prompt table. VFIELD1 is matched to the same-named field that exists on your panel.

By matching, I mean a dynamically created WHERE condition VIEW1.VFIELD1 = value of VFIELD1 in panel. At runtime, PeopleSoft performs SELECT fieldlist FROM VIEW1 WHERE VIEW1.VFIELD1 = value of VFIELD1 in panel.

VFIELD1 in the panel could be a field of a Derived/Work record then you could set it's value in PeopleCode. It should be on the same level or on a level higher than FIELD1's level.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top