Jump to content
Server Maintenance This Week. ×

Finding highest value Date field record from Portal


dav1089

This topic is 2941 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello,

Issue:

I have Sales Activities Portal on each company's record, now I want to list all first rows of portals from each company record on another layout. Now, I also want only those rows with non-empty follow-up date fields too. My Portal is sorted by Activity Date in descending order. 

What I have done:

I have onlayoutenter script as below:

Enter Find Mode
Set Field[Daily Log::date_followup; "*"]
Set Field[Daily Log::date_activity; Max(Daily Log::date_activity)]
Perform Find[]

It is fetching all records from each Portal which has non-empty follow-up date value

 

I want only highest activity date value row from each portal 

Edited by dav1089
typo
Link to comment
Share on other sites

I would suggest you produce this report from a layout of the child table (Sales Activities? Daily Log?). First, find the records where the follow-up date field is not empty. Then sort the records by company and by date and show them in a layout with only a sub-summary by company part (i.e. no body part).

Link to comment
Share on other sites

I am using daily log table(child table) to produce report , on the same layout I have made it to sort it by Sales Person and Activity Date (Sub-Summary : Sales Person).. I have attached the screenshot of how it looks (Layout and script)

I don't want duplicate company daily log sales activities from daily log Portal for each company, instead I only need first record (obviously highest activity date as Portal is sorted by activity date in descending order)

Screen Shot 2016-04-05 at 10.20.43 AM.png

Screen Shot 2016-04-05 at 10.22.18 AM.png

Link to comment
Share on other sites

It cannot work the way you're trying to make it work. Suppose you have 5 companies:  in order to find the 5 most recent records, you would have to perform a find with 5 requests, each with a company ID and the most recent date of that company (which you would have to collect before entering Find mode).

Note also that when you are in Find mode, the expression Max(Daily Log::date_activity) returns empty (and I suspect it does not return what you think it does in Browse mode, either).

My point is that you do not need to do all that. Instead of finding only the most recent records in each group, find all of them (that is those that meet your other criteria regarding the follow-up date) but show only data from the most recent ones, and hide all others.

 

Edited by comment
Link to comment
Share on other sites

This topic is 2941 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.