How can I show a specific record near the top in list view without screen flicker? - filemaker

I have a script (in FileMaker 14) that sets a variable, $_record_number, to Get ( RecordNumber ) based on a specific criterion. Once it's been set, I want to bring that record to the top in list view. (It's possible that the criterion is never fulfilled and that $_record_number is empty.)
The portion of the script that does this looks like the following:
Go to Record/Request/Page [ Last ]
Refresh Window []
Go to Record/Request/Page [ No dialog ; Max ( $_record_number ; 1 ) ]
When the Refresh Window step isn't present, the script doesn't work correctly. Instead of bringing the record to the top of the list view, it brings it to the bottom.
Unfortunately, the Refresh Window step causes the window to flicker as the script redraws the layout.
Is there a way to duplicate the end results of the above steps without using Refresh Window and avoid the screen redraw?
Failed techniques I've tried:
Using Refresh Object instead of Refresh Window targeting objects in both the header and body
Using Go to Related Record with a relationship to the target record

If you're using FileMaker 13 or higher, you can try the Refresh Object script step instead of Refresh Window. See http://www.filemaker.com/help/13/fmp/en/html/scripts_ref2.37.62.html for more details on that specific step.
I've sometimes had issues refreshing portals without Refresh Window, but if you just need the text on a label or button to update when the variable does, it should work fine.

Chuck, one straightforward option would be to add an unstored calc field to your portal table, with a calc of Get(RecordNumber) = $_record_number. You could set the sort of your portal to reverse sort on this calc field. Since only the matching field should match, this should always pop the desired record (if any) to the top, and otherwise, this condition would be ignored.
Another option would be to manually step through your portal in a Loop and stop when you find a match.
Last, I'd wonder if it might be cleaner to store and test against your portal table's primary key instead of its record number, but that's of course beyond the scope of this question. Good luck :-)

I am in FM14, and I think this works: get rid of your lines that go to last record and refresh window and instead insert 'Scroll Window [ End ]', e.g.
Scroll Window [ End ]
Go to Record/Request/Page [ No dialog ; $recordNumber ]

Related

!D/EGL_emulation

After using the !D/EGL_emulation filter to hide the app time stats in flutter I get this annoying label next to the filter text field that tells me how many lines have been hidden in the console log |Showing 122/444| , is there any way to remove this ?!
It's ticking every second and I want to remove it.

PowerApps Get Selected Item from Lookup to make a Button Visible at the Command line bar

I want a button from the command line bar to be visible or invisible depending on whether a record has been selected in the lookup field from the main form or not.
If no record has been selected, then the button should be displayed. Otherwise not.
For this problem, I want to use the Power Fx in PowerApps, but I haven't found a command yet, which shows me the content or something like that of the lookup field. Other field data types like text have worked without problems.
With Javascript, I already managed it without problems, but I would like to do it also in PowerFx if that should work.
Screenshot: https://i.stack.imgur.com/uqDJ6.png
The records come from the Table Company, where the attribute is Companyname.
Commands where I think they might work:
If([Selected Record];true;false);If(IsBlank([Selected Record]);true;false);If(IsBlankOrError([Selected Record]);true;false);If(IsEmpty([Selected Record]);true;false)
I guess there are 2 scenarios:
The Lookup form control element is a Dropdown with a Selected output property. Then your approach would work like If(IsBlankOrError(DataCardValue1.Selected),true,false)
If your form control element is a ComboBox then you could use If(CountRows(DataCardValue1.SelectedItems)>0,true,false) or the above described IsBlankOrError.

In Filemaker, after searching *within* search results, how can I return to my previous search results?

I'm creating an inventory database in Filemaker Pro Advanced (v15) for my little café, and I've made a little red button that appears in the header if any of our items drop down below a certain level, so when I click that button, it shows just those items that need reordering.
It performs that action by running a script like so:
Go to Layout [ “Inventory Reorders Required” (Inventory) ]
Enter Find Mode [ Pause: Off ]
Set Field [ Inventory::Availability ; "Reorder Required" ]
Perform Find []
Sort Records [ Restore ; With dialog: Off ]
It then goes to a duplicated layout whose only difference (aside from color change) is, the button changes to a "show all" function, which is how I want it to act from the main page.
Enter Browse Mode [ Pause: Off ]
Go to Layout [ “Inventory” (Inventory) ]
Show All Records
Sort Records [ Restore ; With dialog: Off ]
If I do a search—for instance, for "coffee beans,"—clicking that little red button from the search results will narrow the search to just the coffee beans that need reordering—NOT all products that need reordering—again, just how I want it to act.
My question is: Like how I have the button set to return to showing all items when clicked from the main page, I'd like it to return to showing all search results when clicked from the search results page. But I can't find any way to do that. My "solution" so far has been to just disable that button from appearing on the search results layout, but it'd sure be a handy feature to have if we can make it work.
Any chance you could open the reorder layout in a new window, preserving your old found set in the background and operating on the new found set in the foreground? Then when the user is done with the reorder window, they can close it (or the button can close the window) and the user will be left with the original found set.
The simplest way could be to just open a new window when you click the red button and show your filtered output. Then, just close the window to return to the window with your previous results. In FileMaker 16, you could have used a card window for this also.
Otherwise, http://www.soliantconsulting.com/blog/2016/03/recreating-a-filemaker-found-set describes several methods of restoring found sets.

How do I set size of colums in a table subform datasheet view in MS Access

I have a subform bugging me. The mainform contains buttons etc. Everytime the user close/open the form, the columns width is reset to whatever the table likes. If i open the table directly, the size is as i want. If i change it in the subform, it is not saved. (See screendump)
I would like "Phase" to stay about 2 cm width. I can enter the subform and edit the "Width" but that is only applied to the other views.
I hope you can help, Emil.
I realize this post is almost 2 years old, but I ran into the same problem and came across this post.
I am running MS Access 2013 on Windows 7 Ultimate. I did not find the solutions offered here to work for me, so, I set out to find something that would work for me before I went to VBA code. (Incidentally, I appreciate the link offered by #Patrick_Honorez in his comment on the original post because that was going to be my fall-back solution.)
Anyway, here is what worked for me and I hope perhaps it will work for others as well:
Open the parent form.
In the subform, right-click the column header
for the column for which you wish to adjust the width.
Select the “Field Width” item from the context menu.
In the “Column Width” dialog that appears in step 3, enter the desired column width in points, or, use the [Best Fit] button. Then click the [OK] button to close the dialog and return to the form.
Right-click the parent form’s border to bring up the parent form’s context menu. Click the “Save” item in the context menu.
Now close the parent form.
The next time the form is loaded, the column widths should be as set it step 4 above--at least they are for my setup.
I see this post is quite old and OP must have figured someway to tackle the issue. I came across same issue today and found solution on this link.
For anybody else having same issue, use following code (I modified the code a little because original code from the above mentioned post saves column width of only text boxes but my form has combo boxes too, column width of which was not getting saved) in close and open events of your subform and then open main form in Form View and then manually select desired widths either by mouse, by entering column width value or using best fit. Save the form and reopen to check results. That's it.
Private Sub Form_Close()
Dim ctrl As Control
For Each ctrl In Me.Controls
If (ctrl.ControlType = acTextBox Or ctrl.ControlType = acComboBox) Then
SaveSetting "propertiesDBS", Me.Name, ctrl.Name, ctrl.ColumnWidth
End If
Next
End Sub
Private Sub Form_Open(Cancel As Integer)
Dim ctrl As Control
Dim frm As Form
Dim w As Long
For Each ctrl In Me.Controls
If (ctrl.ControlType = acTextBox Or ctrl.ControlType = acComboBox) Then
w = GetSetting("propertiesDBS", Me.Name, ctrl.Name, 0)
If w <> 0 Then ctrl.ColumnWidth = w
End If
Next
End Sub
I know this is late to the party and most likely going to be the last comment anyone reads, but this can be done quite simply in MS Access 2016 - by someone like myself who has no more than 4 days experience in databasing overall and no experience with writing custom Macro's or VB Script (using only what is native to MS Access).
Here's how I did it.
Scenario - Split Form (Form + Datasheet).
Extra Recommendations:
It pays to be across all properties of every object type in your database, as a change in a field property can cause unpredictable erratic effects, which take ages to figure out why it happened and how to stop it from happening again, whilst delivering your desired outcome.
Me.Requery in your VBA script after every necessary event and also in your main form (generally the 'After Update' event is used most), and be wary that too many Me.Requery's (in unnecessary events) can also be detrimental - so too much of a good thing can be a bad thing.
Bottom Line Up Front - Modify the format of your query that is to be exported/printed.
In 'Design View' of the query you are concerned with, ensure that the fields are in the order you need them outputted in first as this is exactly how the macro will present them for export/print (example could be "Australia" then "Northern Territory" then "Town's In The Northern Half Of The State" then "Darwin" then "Suburbs In The Northern Half Of City").
Switch to 'DataSheet View' in the same query and use the top left folded over triangle looking thingy to highlight the entire data set then right click that same triangle to present an options menu. Select 'Row Height' and type in "15" (default row height in Excel).
Deselect the entire spreadsheet and this time select every column (left click the left most column, hold shift button, scroll over to the right to the far end of the data set and click the last column) and then right click one of the highlighted columns to present another menu. Select 'Field Width' and within that new pop-up menu select 'Best Fit' and then 'OK'.
(Optional - not sure if this helps or hinders but I did it for my purpose) With the columns still selected right click one of the highlighted columns again and select 'Freeze Fields'.
My scenario had buttons with macros configured to run filtered reports so I was able to check this by simply clicking any of those buttons and seeing the report formatting, which it held true to the work I had just done. I exported using another button with a macro that exports to Excel with 'Print Formatting' selected (my main form also had the datasheet view as the only thing that could be printed and was also set in 'Print' formatting.
The Excel spreadsheet opened with all row heights and column widths in a way that I could read every field/record with perfect ease and without extra modification.
This also worked for cascaded combo boxes, with the export only outputting the 'drilled down/filtered' datasheet records, in a format that required no further modifications.
Hope this helps someone, as its saved my hide! :)
Open the Main form in Design. Go to the SubForm. Click on the square at the top left of the SubForm and select 'Properties'. Right-Click the control 'Phase' and click 'Properties'.Click the 'Format' tab and select 'Width'. What do you see there? That should control the widht of control 'Phase' unless you have some overriding coding elsewhere. Input the size you want and see what happens.
Use continuous forms instead. It gives you complete control over how your subform displays.
If you open your subform directly, your property sheet menu should display automatically if the default view is "Datasheet." Click on "All" and change the "Auto Resize" property to "No." This should solve the issue and avoid the need for VBA.
This only works when you open the subform separately. So if you want the changes to be reflected within your main form, you'll have to close it and switch back and forth.
Super annoying by default.
It seems to work as one would expect of you set the view mode to layout view. Drag column widths as needed and save. Go back to form view and it works. It's really dumb it doesn't work the same way in form view our design view.
In Access 365, open main form, right-click sub-form datasheet columns that need width adjustment, use the Field Width to adjust, click on border of main form to select Layout view, and save changes.
Open subform in datasheet view (by double click on subform in the left pannel)
Resize columns as you want by dragging or by right-click the column header for the column for which you wish to adjust the width and select the “Field Width” item from the context menu.
Right-click the subform border to bring up the context menu. Click the “Save” item in the context menu.
Either open the Main Form in Layout View or directly open your Subform in Datasheet View. Right Click on the Field Header, select Field Width, and enter the desired width. Save. Bewm.
My solution (Access 2016) was to create the main & subform, recreate the subform on its own using form wizard and set it up the way I want it, rename the original subform to something else, and finally rename the recreated subform to the original form name. Open the main form and the subform should be laid out the way you want it. You can then delete the original subform you renamed.

Copy Data from Search results to another items from block in Oracle Forms Builder

Okay, I'm not sure if I can explain this well.
This is what it looks like at runtime:
The list of display items from above are the data that came from database query.
I put a 'When mouse click' trigger to every row so that when I click a row, it copies all the data to the field below. It works when I first try to click a row but when I click another row which supposed to change the data below, NOTHING HAPPENS anymore.
here is my canvas' variable names:
here is what's inside of the 'When mouse click' trigger:
thank you for the help!
Your mouse click code is not working because when you are clicking on search block then currently you are in that block so you should have to move to FLIGHT block before assigning the values also you have to move to next record to populate the values into new record otherwise it will rewrite the values on existing, below is the example given for your problem:
on mouse click add these lines before your code
Begin
Go_Block('flight');
loop
if flight.flight_id is null then
-- look for the empty record if found then exit and assign values
exit;
end if;
-- else continue finding empty record
next_record;
end loop;
end;
--- paste your mouse click trigger code below
I got it. This tiny line of code did the trick.
GO_ITEM(SYSTEM.MOUSE_RECORD);
it simply tells what row number the item you clicked inside the record is in. It gives a char value of zero '0' when you clicked an item outside the record.
For more uses of the SYSTEM variables, check this very useful link. Thanks!
http://oraclet.blogspot.com/2008/02/system-variables-toutorial.html