Go to related records not working as expected - filemaker

I'm having an issue with "Go to related record" script where it's not taking me to the expected set of records.
I have two tables: agendas and items. Agendas can have multiple items and items can exist on multiple agendas. So to support this I created a third table, AgendaItems.
I have two layouts: Agendas (plural) and Agenda (singular). Apologies for the very similar names.
Agendas (plural) is a list-view that displays every agenda as a row. When I click on an agenda I use "Go to related records" to navigate to the Agenda (singular) layout and show only the items for that specific agenda.
Agenda (singular) is a form-view based on the Item table. It contains a portal that displays all items on the agenda. When I click on an item in the portal it shows me the details of that specific item. I'm using a cartesian join to an instance of the AgendaItem's table to accomplish this.
Everything was working great until I tried to put a single Item on multiple Agendas. When I create a second AgendaItem record for an Item the "Go to related records" script stops working as expected.
Specifically, when I try to navigate from Agendas (plural) to Agenda (singular) it takes me to the same set of records each time.
For example, if I click on Agenda A I see items related to Agenda A. But when I click on Agenda B I also see items for Agenda A. If I delete the AgendaItem record that is pointing to an Item for the second time it works again.
What am I doing wrong?

Well, without seing the file, it's hard to pinpoint it excactly, but be careful using a cartesian join with join tables. Regardless of any filter you have in the portal, a cartesian join always resolve to the complete record set in the foreign table.

Agenda (singular) is a form-view based on the Item table. It contains a portal that displays all items on the agenda.
The "Agenda" layout should be based on the Agendas TO. Display the related Items using a portal based on the AgendaItems TO.
To view the related Item record, do it in two steps:
Go to Related Records [ AgendaItems ; current record ]
Go to Related Records [ Items ; found set ]
The first GTRR selects the related AgendaItems records and changes to a layout based on the AgendaItems TO. The second GTRR finds the Items records related to the current found set of AgendaItems records, and changes to a layout based on the Items TO.
BTW if filtering is used to control the display of records in the AgendaItems portal on the Agendas form layout, you can do some processing in-between the two GTRR steps to omit the join records that aren't displayed...
go to related records [ AgendaItems ; current record ]
go to record/request [ first ]
loop
exit loop if [ get( found count ) = 0 ]
if [ <portal_filter_expression> = 1 ]
go to record/request [ next ; exit after last ]
else
omit record/request
end if
end loop
if [ get( found count ) = 0 ]
go to layout [ original layout ]
show custom dialog [ "There are no items to display." ]
exit script
end if
go to related records [ Items ; found set ]

Related

search for the last two rows (by date) in Filemaker 19

I have a Filemaker solution that stores measurement data. For a comparison report, I want to extract only the current and the previous rows of a specific set, and export them to XML.
I can easily search, filter and sort them, but how do I tell Filemaker to limit the resultset to a fixed number of rows?
Here is a simple script that reduces the current found set to the last two records. It is assumed that you have already performed a find and a sort. Then you can do simply:
Go to Record/Request/Page [ First ]
Omit Multiple Records [ Get ( FoundCount ) - 2 ] [ No dialog ]
Add a selection field (selected=1 or unselected=0) and mark the last row and the previous row as selected, then do a search for selected field, export the elements you need, then mark all selection fields back to 0. All this executed from a simple script.

If it's possible, is there an option or other way to change a "Sublist Field" column's display type within a transaction form in NetSuite?

I need to change two columns in a Sales Order's item line section (bottom of the page) in NetSuite: https://i.ibb.co/27vx9Dr/2019-06-20-10-41-13-Window.png
It feels like the solution ties these two together as they are both perceived as item line fields or "Sublist Fields" (according to NetSuite's customization form page).
INVENTORY DETAIL needs to be enabled or set to "normal" so I can be able to specify bins associated from my selected item or be able to interact and fill in this column at the basic level.
AMOUNT needs to be set as "inline-text" so that other people handling sales orders cannot disturb it at all and still be able to see the value of this particular column.
I have attempted to search through Customization > Lists, Records & Fields and searched the following options: (which I thought were relevant to the fields that I wanted to modify)
Item Fields to no success
Transaction Body Fields to no success
Transaction Line Fields found out that AMOUNT and INVENTORY DETAIL are both padlocked
I also attempted to search through Customization > Forms and I have spent a long time looking through my Sales Order custom transaction form (possibly missing out on menus unintentionally) to no success.
I know that inside Customization > Forms > Entry Forms there is an Inventory Detail form in there that shows exactly the window I'm expecting, but I haven't figured out how to customise anything in the columns item line for transaction forms yet so I can create a custom column containing a link to INVENTORY DETAIL simulating the typical behavior of the original one while hiding the disabled one.
Near the top of a Sales Order form, I went to Customise > Customise Form and found out that I can find both AMOUNT and INVENTORY DETAIL inside the Sublist Fields tab.
Unfortunately, it only has SHOW toggles and this does not do what I need for it to do.
It is clear that I am confusing Sublist Fields with Screen Fields where I expected there would typically be a DISPLAY TYPE column that bears the drop-down selections containing "Normal", "Inline-Text" and "Disabled" options.
In actuality, they have SHOW checkbox toggles for both INVENTORY DETAIL and AMOUNT where the AMOUNT checkbox is greyed out. (This still does not achieve or reflect what I need it to do)
I am unaware of the conditions that needs to be met for AMOUNT to behave as an inline-text. There is probably another condition that needs to be met for the INVENTORY DETAIL column to be made available somehow.
I admit that I missed something crucial, so please kindly mention about it.
Any help would be greatly appreciated.
I was able to create a new column by creating a Transaction Line Field that contains two separate fields which are applied to Sales Orders.
For the INVENTORY DETAIL, I went to Customization > Entry Forms and copied the link for "Standard Inventory Detail Form" and then produced my own HTML code inside the Default Value when creating a new Transaction Line Field.
For AMOUNT, I created a new transaction line field and then set the Default Value as the appropriate value found in https://system.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2018_1/schema/record/billingaccount.html and I used the curly bracket notation {} to fetch the data for the edittable AMOUNT but changed the Access to View-only, which makes this exactly what I needed.
After previewing the changes into an existing Sales Order, I can see my results reflected as expected. Consider this question solved.

Heading repeated for every record in the table

My report handles several Members based on a 4-column Members table.
For some reason, each Member is being repeated on the report for every record in the table. How can I configure this such that every member has a separate set of records?
In other words, repeating should consider "MeberName + Test" as one single unit.
Add a Group section based on your Member field. Then right click on that Group and select Section Expert. Check the New Page Before option to configure the behavior you asked for.
Additional help:
Insert page breaks between report groups with two-sided printing

Filemaker 12 -- display one value, store another

I'm building a database in FileMaker 12 that will, among other things, keep a list of jobs (indicated by numeric ID) and the employees who had billable time for that job.
Given three tables:
Employee ( empName, empID, salary, ... )
JobHours ( empID, jobID, hrsWorked, ... , refID)
JobCost ( jobID, expenses, profit, ... , refID)
Where:
Employee is my personnel roster matching names to numeric employee IDs and stats (salary, et al) ;
JobHours is a list of employee participation -- whenever an employee spends time on a job, this table has a line that shows their ID, the job ID, hours worked, and a few other things;
JobCost is a daily record of jobs. One entry in this table refers to the activity for a single job on a single day. Additionally, each entry gets a system generated unique ID (since neither jobID nor date is unique) to relate to JobHours (resulting in a list of who worked on a particular job on a particular day).
I have a form showing records from JobCost. For each record, I can see in a portal, showing records from JobHours, who worked on that job on that day.
Now, the issue.
In my portal, I want to have a drop-down list of employee names pulled from a value list to create records in JobHours with the following criteria:
1) I need it to be a drop-down rather than a pop-up so it will respond to auto-fill from the keyboard. A drop-down will show the secondary value (employee name) from a value list while dropped down, and will respond properly to keyboard autocomplete on the secondary value, but once you've made your selection, it only displays the primary value (employee ID).
2) I need it to display names, not IDs, at all times. The pop-up does this perfectly. However, it doesn't seem to respond to the keyboard for typing autocompletes.
3) I need to store the numeric ID rather than the name.
I know how to satisfy any two of these criteria at once, but that's all. The whole database is working beautifully otherwise. Is this behavior possible?
One common technique is to use two fields, one directly on top of the other.
On the bottom, put your JobHours::EmpID field. Set it up as the drop-down list with the value list that you've specified.
On top of the JobHours::EmpID field put the related Employee::EmpName field. Set the field so that it cannot be entered in browse or find mode.
Now your users will see the Employee Name, but when they click that click will go through the top field and into the Employee ID field where they will choose the name from the value list.
pft's solution is one that I have long used, but I do still find it inelegant because the user still sees an existing id number in the field when changing the value.
If the type-ahead is important, I would use the popup menu. Once the menu has been activated either by tabbing into it or by clicking into it, the user is able to type from the keyboard and the selection will change based on what's entered.
I came to this thread looking for a solution to this same issue (allowing the user to pick from a list, show their choice, but store a related value instead). For example, choose a plant species name from a dropdown, show the plant species name in the dropdown field, but have it store the taxonomic serial number (TSN; which is more likely to stay the same over the years). This is easy to do in MS Access, but took a litlte more messing around to do it in FMP12.
How I solved it:
I created two fields in the table that would be storing the values: Plant_TSN and Plant_SciName. A relationship must exist between the values in these two fields. In my case, I store a SciName for each TSN in a lookup table. I then created two fields in my layout, one for each new field.
For the value you wish to store (ex. Plant_TSN):
Make the corresponding layout field a dropdown and include the show/hide arrow. Edit the value list you will populate the dropdown with to show the second (reader friendly) column but store the first column value. In the layout shrink the field to only show the arrow.
For the field you wish the user to see (ex. Plant_SciName):
make the other layout field a Edit Box and prevent field entry in either Browse or Find mode. But it up against the dropdown arrow created in the previous step to make what looks like one field.
Finally, back in the first field (arrow-only drop down) write a script to push the user friendly number (Plant_SciName) to the edit box when the user-ugly (Plant_TSN) value is picked in the drop down. I used the OnObjectSave script trigger of the dropdown formatted field. Script should be something along the lines of 1) Freeze window, 2) Go to Related Record (based on relationship in lookup table 3) Set Field (i.e. the edit box) and 4) GotoLayout[original] to offset the Freeze.
Probably not an entirely clear explanation, but I bet you will get it on your third read through! I would have posted a screenshot, but I apparently need 10 "reputation points".
Cheers.

Duplicate ALL Filemaker Portal Rows only if valid

I would like to create a script that copies only valid Portal Rows from a Record.
ie. Sample Request is the main record
Sample colours are the relationship (SampleNumberID)
ie. Colour 1, Colour 2, Colour 3, Colour 4
I can get this for work if it has all 4 rows entered, however if there is ok 2 colour entries It will copy it twice to fill up 4 portals every time.
Any help would be great, Thanks.
Image of Current Script working for 4 colour ways however if only 1 colour is entered it will copy the same colour 4 times.
http://www.coquet.com.au/wp-content/Script.png
Here is how I would do it, I would go to the related records, using the portal row relationship. Go to the first record, loop through them all and duplicate each one and then return to the parent record. So it would look something like this:
Go to Related Record [Show only related records; From table: "Sample Request"]
Go to Record/Request/Page [First]
Loop
Duplicate Record/Request []
Set Field [ByCoulor::StyleNumberID; GetNextSerialValue(Get(FileName); "Sample Request")]
Go to Record/Request/Page [Next; Exit after last]
End Loop
Go to Layout [original layout]
As a side note, it looks like you might to set the field StyleNumberID as an Auto-Enter serial number, so you don't have to manually set it.