Jump to content

Need simple way to display previous records


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

Recommended Posts

Posted

On an Event Entry screen, users type in the description of new events, much like keeping a journal. The resulting entries are kept in a single table, which can grow to several hundred entries. To help avoid duplicate entries inadvertantly being made for the same event (by different users), I need to show the "description" field from the previous two or three entries at the top of the layout for their reference. Since I create a new record only when entered information is fully validated, the entries at the top would be Last and Last-1 from the table.

I'm having a mental block on coming up with a simple way to do this without using a portal. I could use a script to find the entries a populate a couple of global fields, but I'm hoping for simple, direct-display method that wouldn't require triggering such a script. Another complicating factor is that this layout references a separate data file that can't be added to at this time. Only my GUI file can be changed.

Any suggestions will be appreciated.

Posted

Why do you not want to use a portal? There are lots of things you can do with the *appearance* of a portal; such as set line width to zero, for instance.

Posted

I agree that a portal would be the way to go but if you don't have a global in your data file and if you also can't add a calculation in your data file (and you don't have vs. 11 to take advantage of filtered portals), then here is one kinda ugly way of accomplishing it.

Note that the UI holds everything needed. The yellow display field is from UI and I formatted it to show as one line (only the last two descriptions). I suppose it could be scripted as well but I personally feel that's what a UI file is for ... work-arounds and calculations without cluttering the data file. :wink2:

There are surely other methods also.

LastTwo.zip

Posted

The LastLessOne TO is novel way to get at that record. Actually, I hadn't considered using Last() because its entry in the Specify Calculation table of function choices says "Last(RepeatingField)" and I thought it only applied to those. I had never bothered to read up on it.

I'm also glad you mentioned filtered portals. I'll be upgrading to FM11 soon and this now looks like an obvious first use.

Thanks for your help.

Posted

How about something in the same vein, just a little simpler? Though I cannot see the big difference between this and a portal - except the portal wouldn't need even that one calculation field.

Of course, you could make it really simple (and ugly) by going into list view and entering data in a trailing grand summary.

Last2.zip

Posted

Good example. But whether portal or not, seems to me that no changes to the data file are required.

Here's another approach, showing a no-lines portal, and also a script-populated global field.

Conditional highlighting also shows when the new description matches a recent description.

EventHistory.fp7.zip

Posted (edited)

There are no changes to the data file in LaRetta's example (or mine).

Read this again:

http://fmforums.com/forum/showpost.php?post/365019/

"but if you don't have a global in your data file and if you also can't add a calculation in your data file..."

Edited by Guest
Posted

I have read it, and I have also looked at the file. There are no changes to the data file.

Correct.

What is your point?

LaRetta says basically, well, if you don't have a global in the data file; and you can't create a calc in the data file; then the next best, not quite as good choice is to do this.

I just didn't see any need to even consider modifying the data file in the first place.

Posted (edited)

Hi Michael,

Yes, that's simpler. I considered GetNthRecord() but thought it might be slower over very large data set. But I suppose no slower than Last(). :smile2:

Bruce,

I never said global was required; I thought K1200 thought it was required (or SOME modification was required in the data file).

LaRetta says basically, well, if you don't have a global in the data file; and you can't create a calc in the data file; then the next best, not quite as good choice is to do this.

If you are going to quote me, quote me ... don't put your interpreted words in my mouth. :tongue2:

You used a portal or script. I provided a different approach.

Edited by Guest
Posted

Perhaps you feel disrespected, and I am sorry if that is the case. But there is nothing inherently disrespectful in the use of paraphrasing, and nothing disrespectful intended by my particular wording. In any kind of communication conflict or confusion, paraphrasing is one of the first and best tools to use, and it worked quickly in this case, to everybody's benefit.

Posted

In any kind of communication conflict or confusion, paraphrasing is one of the first and best tools to use, and it worked quickly in this case, to everybody's benefit.

No. It is not. Particularly when the person misinterprets what was said. It is one thing to paraphrase back to the person, beginning with "so do I understand you to mean..." - it is another to misquote to others.

and it worked quickly in this case, to everybody's benefit.

Except the person you should have been 'paraphrasing' to. Nobody likes words put in their mouth.

Posted

Put me on your Ignore - your Lead Wall - that would be perfect. Then I might be able to be on these forums without dealing with you. I shall do the same.

Posted

This prevents an error in the result when Count ( Data::ID ) = 1 :P

Let(

n = Count ( Data::ID ) ;

If ( n > 1 ; GetNthRecord ( Data::Description ; n - 1 ) & ¶ ) & GetNthRecord ( Data::Description ; n )

)

This topic is 5260 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.