Jump to content

Gather IDs of records under one subsummary part


Grundly

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

Recommended Posts

I've got a Subsummary layout. The layout is based upon the table, lets call it "Materials". The subsummary part is sorted-by the field "Type". Type can have say, one of three possible values in it: Glass, Paper, Plastic. When we sort this layout, we get subsummaries by the types, Glass, Paper, and Plastic, as expected. There's a script that performs some Finds, based on user-entered criteria, to narrow down that list.

What I need to do now is have a script gather the IDs of only the records under, say, Paper. And only Paper. Suppose three records are showing under Paper, I want those three records' IDs in some form or another. So far I've only been able to have it gather ALL of the IDs in the whole table (wrong), or, only gather the first ID under the subsummary part (also wrong). 

My third method works and returns the desired results, but feels "dirty", so i hope to hear about a better way. That is, I perform a Find based on the last known Find criteria, adding in to that mix, the ID of the subsummary part they chose (=Paper), to actually go find and truly isolate those three records in question, then I can gather their IDs. But that throws off my Found Set, is slow, and requires more work afterwards to restore the layout to how it was before. Not a great solution either.

Any input would be appreciated. Thanks!

Edited by Grundly
Link to comment
Share on other sites

1. I don't fully understand the question. I'll attempt to answer: There are records present representing all three Types. The sub summary layout is sorted by Type. Thus in my hypothetical example, you will end up with three sub summary sections when sorted by Type, each with some records in them. One sub summary section for Type "Paper", one sub summary section for Type "Glass" and one sub summary section for Type "Plastic". This is already built and works as expected, nothing tricky, nothing unusual.

2. The purpose is to have a list of IDs, stored in a variable in a script (or placed into a field), which will go to other parts of the database and perform any number of other operations outside the scope of this question, to which I am not at liberty to disclose. You could say, simply "to export them", or any number of other valid reasons to wish to have a list of IDs. To want a list of IDs is to want a list of IDs. That is the goal, to produce a list of IDs. 

I'll add: there will be a button in the Subsummary part. It is this button that should trigger the new, unwritten script that has yet to be built, which should gather the IDs of only the records in THAT particular sub summary part. If we end up with three Subsummary sections by Type, it follows that we will end up with three of these buttons, via usual operation of sub summary parts. Clicking the first button will yield a list of IDs for the records within the first sub summary part, and only those of the first sub summary part (all Type=Glass records). Clicking the second button should yield a list of IDs for the records within the second sub summary part, and only those of the second sub summary part (all Type=Paper records) . Clicking the third button should yield a list of IDs for the records within the third sub summary part, and only those of the third sub summary part (all Type=Plastic records).

The found set can change. It is dynamic. Users can and will change the Found Set. When they do, the script they used to produce the new Found Set also re-applies the sort order by Type field, so the layout is always presented with active Sub-summary by Type parts. 

Thank you!

Link to comment
Share on other sites

If you define a field named sListIDs as a summary field = List of [ID], you can then make your button do:

Set Variable [ $$listOfIDs; Value: GetSummary ( YourTable::sListIDs ; YourTable::Type ) ]

This variable will contain a list of ID values of the records within the clicked sub-summary part.

 

Quote

The purpose is to have a list of IDs, stored in a variable

Having something in a variable is always a means to something else, never a purpose on its own. This question has all the signs of being an XY problem. This is why I don't like giving the answer above. It is very likely not the best solution to whatever the real problem here is.

Why do I care about that? Because this is a public forum, and the answers are supposed to serve not only you, but others as well. As things stand now, there is practically nothing for anyone else reading this to learn here.

  • Like 1
Link to comment
Share on other sites

33 minutes ago, comment said:

If you define a field named sListIDs as a summary field = List of [ID], you can then make your button do:


Set Variable [ $$listOfIDs; Value: GetSummary ( YourTable::sListIDs ; YourTable::Type ) ]

This variable will contain a list of ID values of the records within the clicked sub-summary part.

 

Perfect, this works great! Produces the sub-summary's record IDs in the form of a return-separated list, which is exactly what I needed. This is so much faster and cleaner. Thank you very much!

Link to comment
Share on other sites

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