Hi
I tried the same with tables it is working fine. Place the below code at onSelect property of a button and try, it will display the Particular student's top score and corresponding subject.
Set(StudentMarksDetail ,Table(
{
StudentID: "1",
Math :"10",
Science:"20",
Social:"15"
},
{
StudentID: "2",
Math :"40",
Science:"20",
Social:"25"
},
{
StudentID: "3",
Math :"32",
Science:"43",
Social:"46"
},
{
StudentID: 4,
Math :11,
Science:30,
Social:15
}
)
);
ClearCollect(StuDetailsColl,First(Filter(StudentMarksDetail,StudentID = "1"))); //use Selected studend id to filter
Set( StudentMarksNew,Table(
{
ID:Text(First(StuDetailsColl).StudentID),
MarksSecured:Text(First(StuDetailsColl).Math), //Marks For the Subject1
SubDesc: "Mathematics" //Harcoded Description for subject 1
},
{
ID:Text(First(StuDetailsColl).StudentID),
MarksSecured:Text(First(StuDetailsColl).Science), //Marks For the Subject2
SubDesc: "Science" //Harcoded Description for subject 2
} ,
{
ID:Text(First(StuDetailsColl).StudentID),
MarksSecured:Text(First(StuDetailsColl).Social), //Marks For the Subject3
SubDesc: "Social" //Harcoded Description for subject 3
}
));
Notify(
Concatenate(
Text(First(Sort(Filter(StudentMarksNew,ID="1"),MarksSecured,SortOrder.Descending)).MarksSecured),
"----",
Text(First(Sort(Filter(StudentMarksNew,ID="1"),MarksSecured,SortOrder.Descending)).SubDesc)),
NotificationType.Information);
Note : While inserting to second table you should insert in the subject order of your main table because the subject description is hard coded.