0
votes

Just want to ask how to show top 10 documents only based on a column value using view selection? The formula of the view selection is in the code snippet below.. then there are 50 documents in the view. How do I arrange them according to top 10 highest value of the a column?

SELECT Form = "MPPP" & MPPPValid != "No" & Status != "Draft" & ProductEndOfLife!= "Product is End of Life" & NonIBMProduct!= "Non IBM Product" & @If(
((

(@If(GDis_0 != ""&L_0!="";L_0;
@If(GDis_1 != ""&L_1!="";L_1;
@If(GDis_2 != ""&L_2!="";L_2;
@If(GDis_3 != ""&L_3!="";L_3;
@If(L_0=""&UL_0!="";UL_0;
@If(L_1=""&UL_1!="";UL_1;
@If(L_2=""&UL_2!="";UL_2;
UL_3))))))))*

(@If(GDis_0 != ""&W_0!="";W_0;
@If(GDis_1 != ""&W_1!="";W_1;
@If(GDis_2 != ""&W_2!="";W_2;
@If(GDis_3 != ""&W_3!="";W_3;
@If(W_0=""&UW_0!="";UW_0;
@If(W_1=""&UW_1!="";UW_1;
@If(W_2=""&UW_2!="";UW_2;
UW_3))))))))*

(@If(GDis_0 != ""&D_0!="";D_0;
@If(GDis_1 != ""&D_1!="";D_1;
@If(GDis_2 != ""&D_2!="";D_2;
@If(GDis_3 != ""&D_3!="";D_3;
@If(D_0=""&UD_0!="";UD_0;
@If(D_1=""&UD_1!="";UD_1;
@If(D_2=""&UD_2!="";UD_2;
UD_3)))))))))/6000000)-

(@If(GDis_0 != ""&PW_0!="";PW_0;
@If(GDis_1 != ""&PW_1!="";PW_1;
@If(GDis_2 != ""&PW_2!="";PW_2;
@If(GDis_3 != ""&PW_3!="";PW_3;
@If(PW_0=""&ULW_0!="";ULW_0;
@If(PW_1=""&ULW_1!="";ULW_1;
@If(PW_2=""&ULW_2!="";ULW_2;ULW_3))))))))>10 |

(((((@If(GDis_0 != ""&L_0!="";L_0;
@If(GDis_1 != ""&L_1!="";L_1;
@If(GDis_2 != ""&L_2!="";L_2;
@If(GDis_3 != ""&L_3!="";L_3;
@If(L_0=""&UL_0!="";UL_0;
@If(L_1=""&UL_1!="";UL_1;
@If(L_2=""&UL_2!="";UL_2;UL_3))))))))*

(@If(GDis_0 != ""&W_0!="";W_0;
@If(GDis_1 != ""&W_1!="";W_1;
@If(GDis_2 != ""&W_2!="";W_2;
@If(GDis_3 != ""&W_3!="";W_3;
@If(W_0=""&UW_0!="";UW_0;
@If(W_1=""&UW_1!="";UW_1;
@If(W_2=""&UW_2!="";UW_2;UW_3))))))))*

(@If(GDis_0 != ""&D_0!="";D_0;
@If(GDis_1 != ""&D_1!="";D_1;
@If(GDis_2 != ""&D_2!="";D_2;
@If(GDis_3 != ""&D_3!="";D_3;
@If(D_0=""&UD_0!="";UD_0;
@If(D_1=""&UD_1!="";UD_1;
@If(D_2=""&UD_2!="";UD_2;UD_3)))))))))/6000000)-

(@If(GDis_0 != ""&PW_0!="";PW_0;
@If(GDis_1 != ""&PW_1!="";PW_1;
@If(GDis_2 != ""&PW_2!="";PW_2;
@If(GDis_3 != ""&PW_3!="";PW_3;
@If(PW_0=""&ULW_0!="";ULW_0;
@If(PW_1=""&ULW_1!="";ULW_1;
@If(PW_2=""&ULW_2!="";ULW_2;ULW_3)))))))))/

(@If(GDis_0 != ""&PW_0!="";PW_0;
@If(GDis_1 != ""&PW_1!="";PW_1;
@If(GDis_2 != ""&PW_2!="";PW_2;
@If(GDis_3 != ""&PW_3!="";PW_3;
@If(PW_0=""&ULW_0!="";ULW_0;
@If(PW_1=""&ULW_1!="";ULW_1;
@If(PW_2=""&ULW_2!="";ULW_2;ULW_3)))))))))>0.2;
@True;@False)

Snippet of the column value:

((((@If(GDis_0 != ""&L_0!="";L_0;@If(GDis_1 != ""&L_1!="";L_1;@If(GDis_2 != ""&L_2!="";L_2;@If(GDis_3 != ""&L_3!="";L_3;@If(L_0=""&UL_0!="";UL_0;@If(L_1=""&UL_1!="";UL_1;@If(L_2=""&UL_2!="";UL_2;UL_3))))))))*(@If(GDis_0 != ""&W_0!="";W_0;@If(GDis_1 != ""&W_1!="";W_1;@If(GDis_2 != ""&W_2!="";W_2;@If(GDis_3 != ""&W_3!="";W_3;@If(W_0=""&UW_0!="";UW_0;@If(W_1=""&UW_1!="";UW_1;@If(W_2=""&UW_2!="";UW_2;UW_3))))))))*(@If(GDis_0 != ""&D_0!="";D_0;@If(GDis_1 != ""&D_1!="";D_1;@If(GDis_2 != ""&D_2!="";D_2;@If(GDis_3 != ""&D_3!="";D_3;@If(D_0=""&UD_0!="";UD_0;@If(D_1=""&UD_1!="";UD_1;@If(D_2=""&UD_2!="";UD_2;UD_3)))))))))/6000000)-(@If(GDis_0 != ""&PW_0!="";PW_0;@If(GDis_1 != ""&PW_1!="";PW_1;@If(GDis_2 != ""&PW_2!="";PW_2;@If(GDis_3 != ""&PW_3!="";PW_3;@If(PW_0=""&ULW_0!="";ULW_0;@If(PW_1=""&ULW_1!="";ULW_1;@If(PW_2=""&ULW_2!="";ULW_2;ULW_3)))))))))/(@If(GDis_0 != ""&PW_0!="";PW_0;@If(GDis_1 != ""&PW_1!="";PW_1;@If(GDis_2 != ""&PW_2!="";PW_2;@If(GDis_3 != ""&PW_3!="";PW_3;@If(PW_0=""&ULW_0!="";ULW_0;@If(PW_1=""&ULW_1!="";ULW_1;@If(PW_2=""&ULW_2!="";ULW_2;ULW_3))))))))

Would appreciate help. Thanks.

1
I want to congrat you, you made the biggest selection for a view for my 10 years of experience :)Dmytro Pastovenskyi

1 Answers

2
votes

It can't be done in any reasonable way with just the capabilities of a view selection formula because those formulas work with one document at a time. They simply cannot compare one document to the others and decide "is this one in the top 10?" Not without help.

You can write an agent that runs against all of the documents. It can be triggered whenever a document is created or modified. That agent can iterate through all the documents and use whatever logic it needs to sort and compare them, and it can set a special item TopTen equal to @True or @False. Then all you will need to do with your selection formula is put the whole thing (except the SELECT keyword) inside parentheses and add & (TopTen = @True) to the end.