Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted (edited)

I need a script that will omitt a record from a layout, if (Field XYZ = 0) Then Omitt those records...via a Go To Layout Button. Can anyone help me with this? I've tried to figure it out but no luck.

Edited by Guest
Posted

I'm not quite sure I understand your need. If you are saying you want to show all records in a layout except those meeting criteria Field XYZ = 0, then you can try attaching this script to your Go to Layout button:

Freeze Window

Go to Layout [ thatLayoutName ]

Constrain [ Field XYZ ; 0

Show Omitted Only

If this isn't exactly what you need, please explain a bit more and we'll help you through it. :wink2:

LaRetta

Posted (edited)

Well it kinda works:

1 Layout (Contracts) orignal layout with Go To Button

2. Layout(Dollar and Percent)

Go to button is on contracts layout, with script when I click it , it goes to Dollar & Percent layout, but it comes up with (No records match this set of find request. Modify Find- Continue - Cancel.)

I choose continue it shows ALL records in Dollar and Percent layout (including Field XYZ = 0)

then when I return (via back button) to Contracts layout and hit the Go To Button again it goes to Dollar and Percent layout and shows the correct records, the exact ones that I want.

Now I need to get it to do that the First time I click it.

And thank you for the help.

Edited by Guest
Posted

It would be easier to Constrain() :notequal: 0 ... it would save needing the Show Omitted Only step. You could also perform a regular find. You just caught me on a day when I had used Constrain(), Show Omitted probably 20 times so it was on my mind. My approach here is not the most efficient. :smirk:

Posted (edited)

Still having same problem, Thought I had it until I shut it down & restarted. Too weired it works sometimes & sometimes it dosen't

Also the only constrain I can find is Constrain Found Set...is that right?

Edited by Guest
Posted

Why is the find layout dependent, when such things aren't ...Are the request instead to omit cards where the field is empty?

LaRetta might forget that request by fm7 can be hardwired inside say a Constrain[ step, but as such needs a scripted matter like this include a error capture clause.

Set Error Capture [ On ] 

Constrain Found Set [ Specified Find Requests: Omit Records; Criteria: myTable::aField: “0” ] [ Restore ] 

Set Error Capture [ Off ] 

If [ Get ( FoundCount ) ] 

     Go to Layout [ “dollars_and_percentage” ] 

Else 

     Show All Records 

End If

--sd

Posted (edited)

Thanks, I think it works the way I need it to now... Well it works if I have a record with the field = 0 , If no record exists with field XYZ = 0 then I get that Modify,Continue, Cancel.

Edited by Guest
Posted

I guess I posted a question on the wrong place, , so I hope this is the right place. My question is this, why is a script written for a button ( Show All Records) and Show all records from the Records Tool bar at the top of FM different?

I have a button with "Show All Records" that dosen't (it says No Records: Need to create New Record) , but there are records I just omitted then with a "Omit Records with File XYZ = 0"

However when I use "Show All Records from top menu bar it works properly. Can someone tell me how to write a scripe that will work just as the Menu toolbar Show All Records does?

Thanks

Posted

Script-steps fire on the table based upon the current layout. Show All Records works just as well from script as from status area. I would assume that script is firing on a different layout. Go to Layouts > Layout Setup and see what table occurrence is specified. Place a button on that layout and and fire it. Also make sure the script attached to that button only contains that script line. Sometimes a button has two scripts attached ... select the button and Arrange > Ungroup to make sure a different script isn't firing.

Thanks for the catch, Soren.

As Soren pointed out, you need to add a Set Error Capture [On] (look again at his script). This will stop the Modify/Cancel message display.

Posted

The script is firing on the correct layout. I I have a button on that layout Also the script attached to that button only contains that script line.

When I fire "Show Still Own Button" ( which omits all records with field XYZ = 0)If there are no records left it reverts to a blank Layout ( No record) that says: Need to create New record, and Record 0, Found 0, Unsorted 2

My show all Records Button will Not show me those 2 records. ( If I use show all records from the menu toolbar at top , it will show me those 2 records?

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