Peoplesoft rowset - peoplesoft

I'm new to peoplesoft. I need a help in understanding the rowset and I have a requirement where i have 3 levels.
On level 1 i have a checkbox and when I open a component the value of the checkbox on level 1 should be passed and display to the level 2 grid for all rows.
For example
level0 - record1
level1 - record2 (Scroll Area)
level2 - record3 (grid)
When i access the page it should have values like this
Record2.field1 = Y => Row1 Record3.field1 = Y
Row2 Record3.field1 = Y
Record2.field1 = N => Row1 Record3.field1 = N
I have written the code at level2 record.field rowinit peoplecode event. but the problem is the same record field is used in level 0 as well. Is there a way where I can avoid using for loop as there could be n number of rows in the grid which might create a performance issue during page opening.
Thanks in advance,

Rowinit will fire for each rows in the scroll. So if you have a loop in the rowinit, loop will execute for each row.
If you want the check box to be set only during the component load, you can add the peoplecode in Component PostBuild.
&rsLevel1 = GetLevel0()(1).GetRowSet(Scroll.Level1);
for &nCnt1 = 1 to &rsLevel1.activerowcount
&rsLevel2 = &rsLevel1(&nCnt1).GetRowset(Scroll.Level2);
for &nCnt2 = 1 to &rsLevel2.activerowcount
&rsLevel2(&nCnt2).Level2.Check_box.value = &rsLevel1(&nCnt1).Level1.Check_box.value
end-for;
end-for;

Related

SQLite: how to highlight fields outside of trigger spec?

I have an SQLite table as such:
A
B
0
0
1
1
and the following trigger specs that fire on update or insert for each column:
A = 0
B = 1
In the application, I need to display the rows that break the specs, with culprit fields highlighted, as such:
A
B
0
0
1
1
I honestly don't know how to approach this. Would this require that I somehow return a 'bitmap' of the table along with the selected data? Is there a better way to 'tag' fields?
Thanks!
In a query all you can have is 2 extra flag columns (one for each of the columns A and B) with 0 or 1:
SELECT *,
A = 0 flag_A,
B = 1 flag_B
FROM tablename;
In your application you can check the values of the flag columns and highlight a column if its flag is equal to 0.
See the demo.

Creating a check box dynamically

Can we create a checkbox dynamically on a window in progress? Actually i have created combo-box,frame,fill-in dynamically but not getting the idea how can I Create checkbox dynamically.
display "Example" skip(2) with frame a width 80.
define variable h as handle no-undo.
create toggle-box h assign
row = 2
column = 1
label = "hi there"
frame = frame a:handle
sensitive = true
visible = true
.
wait-for window-close of current-window.

How can i make database access fast of progress 4gl

i have to make a database access fast which contains large data of unique index mstr_nbr how can i make it fast.
in which get first mstr taking 0ms
and get next mstr takes most of the time 0ms but sometimes takes 1ms
means in 180000 for each mstr runs 12000 runs takes 1 ms which is increasing the time and if no of serial loop increases every time 12000ms second also increase this is a webspeed generated webpage how can i make it fast...anyone help
DEFINE QUERY Mstr FOR mstr scrolling.
OPEN QUERY Mstr FOR EACH mstr no-lock
where (Mstr_status = "close" or Mstr_status = "closed").
FOR EACH serial
WHERE (serial_pallet = f_pallet AND serial_f_chr11 <> "BOX")
or (serial_key begins f_pallet)
NO-LOCK BREAK BY serial_pallet by serial_parent by serial__chr11 QUERY-TUNING(LOOKAHEAD CACHE-SIZE 32768 DEBUG EXTENDED):
GET FIRST Mstr.
define variable roID as rowid no-undo.
roID = rowid(mstr).
DO WHILE NOT QUERY-OFF-END('Mstr'):
for each det fields(detnbr detmodel detlot detqty) no-lock
where (detnbr = mstr_nbr) and (detmodel = serial_parent and detlot = serial__chr11):
tinspected = tinspected + detqty.
end. /* for each */
GET NEXT Mstr.
END.
reposition mstr to rowid roID.
end.
index for mstr table
index-name field-name
badgenew 1 badgenew Active
datenew 1 datenew Active
nbridx 1 nbr Unique Primary Active
pallet 1 pallet Active
proddesc 1 proddesc Active
prodline 1 prodline Active
status 1 status Active
type 1 type Active
indexes for table serial:
actual_prod_day 1 dte04 2 serial_chr01 Active
actual_prod_line 1 serial_pallet 2 serial_dte04 3 serial_chr01 4 serial_line Active
pallet_prod 1 serial_pallet 2 serial_dte04 Active
pallet_prod_line 1 serial_pallet 2 serial_dte04 3 serial_line Active
serial_chr01 1 serial_chr01 Active
serial_chr05 1 serial_chr05 Active
serial_chr06 1 serial_chr06 Active
serial_chr11 1 serial_chr11 Active
serial_chr14 1 serial_chr14 Active
serial_dte04 1 serial_dte04 Active
serial_int01 1 serial_int01 Active
serial_line 1 serial_line Active
serial_pallet 1 serial_pallet Active
serial_parent 1 serial_parent Active
serial_serial__key 1 serial_serial__key 2 serial_parent Unique Primary Active
serial_pallet serial_key and serial_c11 all are character data type
indexes for table det:
detidx 1 detnbr 2 detpallet 3 detprodline 4 detbox 5 detlot 6 detshift Unique Primary Active
detlot 1 detlot Active
detmodel 1 detmodel Active
detnbr 1 detnbr Active
detpallet 1 detpallet Active
detprodline 1 detprodline Active
Given what we know this is how I would code it:
define temp-table tt_mstr
field mstr_nbr as integer /* or whatever the proper data type is */
index mstr_nbr-idx is primary unique /* I am assuming mstr_nbr is unique */
.
for each mstr no-lock
where mstr.mstr_status = "close"
or mstr.mstr_status = "closed":
create tt_mstr.
tt_mstr.mstr_nbr = mstr.mstr_nbr.
end.
for each serial no-lock
where ( serial_pallet = f_pallet and serial_f_chr11 <> "box" ) /* <> "box" is going to perform poorly, there may be better ways to do this */
or ( serial_key begins f_pallet ):
/* break by serial_pallet by serial_parent by serial__chr11: ** this sort of pointless, you're just adding up "tinspected", the order and the break groups have no impact */
for each det fields( detnbr detmodel detlot detqty ) no-lock
where detmodel = serial_parent and detlot = serial__chr11:
find tt_mstr where tt_mstr.mstr_nbr = detnbr no-error.
if available tt_mstr then
tinspected = tinspected + detqty.
end.
end.
Using a temp-table avoids refetching all of the "close" and "closed" records with every iteration of the "serial" table.
Maybe there is some context missing but the scrolling query and repositioning of the row seem pointless.
The selection of "serial" records does not look very efficient but I would need to know what indexes are available and what the data in serial_pallet serial_key and serial_c11 looks like. If there are just a few discrete values there may be better ways to write that.
You have single component indexes on each of the fields serial_pallet, serial_f_chr11, and serial_key. So there is not much help there.
This is speculation but if the number of discrete values in serial_f_chr11 is small you would probably be better off with a series of equality matches and OR. Suppose the valid values are BOX, JAR, BAG, and LOOSE. In that case, instead of:
where ( serial_pallet = f_pallet and serial_f_chr11 <> "box" )
or ( serial_key begins f_pallet )
you could write:
where ( serial_pallet = f_pallet and serial_f_chr11 = "jar" )
or ( serial_pallet = f_pallet and serial_f_chr11 = "bag" )
or ( serial_pallet = f_pallet and serial_f_chr11 = "loose" )
or ( serial_key begins f_pallet )
That would be even better if you have a composite index on serial_pallet + serial_f_chr11.
If the number of discrete valid serial_f_chr11 values is larger or if new values might get added then it would be better to add them to a temp-table and join on that instead.
Another option is that rather than loop over all of the master records to find matching details, select details that match the serials first. Then find the appropriate master record. That eliminates a whole layer of looping. But it depends on proper indexes in the "det" table. You must have an index that has serial_parent and detlot as leading components.
If mstr_nbr is not the same field as "nbr" (as shown in your index listing) then you need to build the TT and add an index on mstr_nbr. If, however, nbr is actually the same as mstr_nbr then you could skip the TT and directly query the database table efficiently.

How to select n rows using IDataReader

[ASP .Net - Microsoft Visual Web Developer 2010]
Hi all,
I've problem with this code:
With MenuNavCatDataSource
Dim xReader As Data.IDataReader = .Select(DataSourceSelectArguments.Empty)
If xReader.Read Then
MenuNavCat1.Text = xReader.Item("MenuCategoryName")
MenuNavCat2.Text = xReader.Item("MenuCategoryName")
MenuNavCat3.Text = xReader.Item("MenuCategoryName")
MenuNavCat4.Text = xReader.Item("MenuCategoryName")
MenuNavCat5.Text = xReader.Item("MenuCategoryName")
End If
End With
I've 5 label and I want to parse the content of the label from the database. The database contains menus ordered from 1 to 5. And I want to show it on:
- 'MenuNavCat1' label, menu with order number 1 on database,
- 'MenuNavCat2' label, menu with order number 2 on database, and so on...
How to add where statement to the code, just like 'WHERE OrderNo = 1', and so on..?
Need your help guys..
Thank you so much.
EDIT
Here is the database:
Table MenuNavCategory
| Column Name | Data Type |
|-----------------------------|
| MenuNavCatID | int |
| CategoryName | varchar(20) |
| OrderNumber | int |
|-----------------------------|
And there is some value inserted to the table.
I want to show the 'CategoryName' onto some label.
For example:
lblCat1 | lblCat2 | lblCat3 | lblCat4
Then, using that xReader.Read, store the value on the database onto that label based on the OrderNumber...
The DataReader only reads one row of data at a time. If you have 5 labels then you should have 5 rows in your database. Then you iterate through each row using the DataReader and assign the labels:
With MenuNavCatDataSource
Dim xReader As Data.IDataReader = .Select(DataSourceSelectArguments.Empty)
'i is just a counter to keep track of what row we are on.
Dim i as integer = 1
If xReader.Read Then
Select Case i
Case 1 'First Row from DB.
MenuNavCat1.Text = xReader.Item("MenuCategoryName")
Case 2 'Second Row from DB... etc.
MenuNavCat2.Text = xReader.Item("MenuCategoryName")
Case 3
MenuNavCat3.Text = xReader.Item("MenuCategoryName")
Case 4
MenuNavCat4.Text = xReader.Item("MenuCategoryName")
Case 5
MenuNavCat5.Text = xReader.Item("MenuCategoryName")
x+=1
End If
End With
The above is just an example to try and explain how the DataReader works. I'd find another way to actually code it as the above relies on the rows in the database being in the correct order and is pretty ugly.

How to add a div after every 5 rows of data?

I'm trying to add div after a group of 5 rows of data inside Listview.
I came up with using Mod 5 = 0 but I realized the last row is missing if total row count can't divided by 5.
For example, I have 11 rows of data.
"Div" will be added after 5 and 10.
I also need to add "Div" after 11 as well. (div will display details of each group)
So, something like this
1|2|3|4|5
DIV1
6|7|8|9|10
DIV2
11|
Div3(missing)
Here is inline code I have so far
<%# IIf((Container.DisplayIndex + 6) Mod 5 = 0, "<div id='temp" + Math.Floor((Container.DisplayIndex + 6) / 5).ToString + "' style='display:none'></div>", "")%>
How do I add the last div when total # can't be divided by 5?
I have to get the total# of display index somehow...
You can compare it with the ListView.Items.Count property.
This should work:
Dim addDiv = (Container.DisplayIndex Mod 5 = 0) OrElse _
(Container.DisplayIndex + 1 = ListView1.Items.Count)
If you are using paging you should use DataItemIndex instead of DisplayIndex.
Edit: (according to your last comment)
If you need to show the total record count you have to cast the ListView's DataSource to it's correct type(f.e. a DataTable).
Dim tbl as DataTable = DirectCast(ListView1.DataSource, DataTable)
Dim totalCount as Int32 = tbl.Rows.Count
or in one line:
DirectCast(ListView1.DataSource, DataTable).Rows.Count
But this works only on databinding and not on every postback because the DataSource will be disposed at the end of the Page-Lifecycle.
the "+6" makes it look like you're guessing around how the modulo function works :)
try this:
<%# IIf(Container.DisplayIndex Mod 5 = 4 Or Container.DisplayIndex = ListView.Items.Count , "<div id='temp" + (1+Math.Floor(Container.DisplayIndex/5)).ToString + "' style='display:none'></div>", "")%>
so first (index+6)%5 == 0 is the same as index%5 == 4,
second floor((index+6)/5) results in 2 when index=4, this is not what you want.
using 1+floor(index/5) will give you the correct results --- you could even drop the "1+" if you want the index to start from 0.
(p.s. i don't know asp.net, sorry if there's compiler errors)

Resources