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

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

Recommended Posts

  • Newbies
Posted

Hi Guys,

 

I am hoping somebody can help me with this issue as it has me stumped.

 

The Scenario

I have a portal embedded on a layout that shows a set of records dependent on a relationship. The layout shows details for a job that we maintain, the portal shows a list of Equipment for that site with scheduled service dates etc.

 

The Portal has check boxes that can be used to select records by inputting the RecordID into a global field and then using Substitute to remove said record from the global field but leave the others intact.

 

Based off of all this the intention is that I have a set of global fields above the Portal that users can update various information and then click a button which executes a script which cycles through all the check records and sets the respective fields.

 

The Problem

While that method works great for the check boxes I am unsure about to translate the unique RecordID into a Portal Row Number for the purpose of only changing the data on the rows that are checked. Now my obvious thought was to instead use RecordNumber in the global field for setting the check boxes which brings me to my problem.

 

They all set just fine, same as RecordID but with the RecordNumber being relevant to my found set, great. But then if I start to uncheck them all of a sudden my Substitute fails and Portal Row 9 also removes Portal Rows 18 & 19 and somehow adds a number like 112 into my global field for a Portal of only 25 records. This is the EXACT same script as I am using for RecordID but for some reason RecordNumber fails. ActivePortalRowNumber has the same result.

 

So what am I doing wrong? Is there another way to translate the RecordID to a PortalRow?

 

The script for setting the global looks like this:

Case (
 ValueCount ( FilterValues ( Globals::gExtinguisherCheck ; Extinguishers::RecordID ) ) > 0;
  Substitute ( Globals::gExtinguisherCheck ; Extinguishers::RecordID & ¶ ; "" ) ;
  Globals::gExtinguisherCheck & Extinguishers::RecordID & ¶
)
 
 
I have also tried this using a script that did the same thing using Variables, same problem.
 
 
Thanks.
Posted

I'm sorry to say that I don't really understand what it is that you are trying to accomplish.  What is it that you are actually trying to achieve with the checkboxes or what is the desired behavior? 

 

My impression, though, is that there may be a simpler way to achieve your objective.  It might be illustrative to add the same field to your layout, formatted as a checkboxes and as an edit box. Note that selecting check boxes will add or remove values from the field in the edit box.  Is this what you are trying to achieve in your script?  If so, then maybe all you need to do is create a value list that includes all of the Record IDs. 

 

If I'm not mistaken, Get (RecordID) returns a unique number for the record that is static, permanent, and is set at the time of record creation.  Get (RecordNumber), on the other hand, returns a number that reflects the position of the record in the sort order of the current found set.  

 

Does that help? 

Posted

I think you're making this way too complicated (look who's talking … :smile: ), because …

 

… you could use a global field to maintain a list of IDs for the selected records, where clicking a portal row adds or removes the ID from this global; or you could use a checkbox in the related table to mark a row – but I don't see any reason to use both methods at the same time!   

 

Just loop over all portal rows, and only update the row if the respective checkbox is set (don't forget to reset it as the last update step), or, if you'd rather use the global ID gathering method, if the ID of the current row in your loop has a FilterValues hit with the global field.

 

Only thing your script needs to find out now is if there is at least one record checked (or the ID global isn't empty); if not, exit right away.

Posted

Your calc is failing because using Substitute( $list ; "9¶" ; "" ) on a list like

 

19

8

29

20

9

 

will give you a list of

18

220

9

 

Think about it.

 

 

I think you'll find the native functions FilterValues() and List() helpful, as well as the custom function AntiFilterValues(). Personally, I use a global variable for this (with a repetition tying it to the layout name).

 

Let([
id = Extinguishers::RecordID ;

vals = Globals::gExtinguisherCheck ;

exists = not IsEmpty ( FilterValues ( vals ; id ) ) ;
result = If ( exists ; AntiFilterValues ( vals ; id ) ; List ( vals ; id ) )

];
result
)

 

 

Forget about using the record number of the portal, it's not very stable (changing the field of the sort order, another user deleting a child record, etc will change the sort order). Use the primary key for the child records. RecordID has a specific meaning in Filemaker and it's a rarely needed function. It's ok to use, but most developers prefer to use the table's developer-defined unique ID field (called the primary key).

 

You can loop through the portal as eos recommends or you can go to the related child table and create a found set of those records.

  • Like 1
  • Newbies
Posted

Thanks guys this solves my problem. Was looking at it all wrong.

 

The fact that RecordID worked and RecordNumber did not was tripping me up since they are both just numbers but I was looking at it wrong anyway. I will loop through all the portal rows and get them to look for a match, didn't think of that before.

 

To clarify I am not using both the global and local method just the global and a button that loads the value into the global.

 

Thanks.

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