March 21, 201411 yr I'm attempting to use conditional object display to display a set of buttons for only the active portal row. However, so far I've run into a limitation that was present in FM12 when using a data separation model, namely {{ActivePortalRowNumber}} and {{RecordNumber}} do not calculate from the same context. For example, if I have a 3 portal rows and I click into the first portal row, I can easily see that {RecordNumber}} displays the correct number of the record in relation to the portal row on my interface file. But when I try to add conditional formatting using: Get ( ActivePortalRowNumber ) = Get ( RecordNumber ) The result returns false for everything other than the first row of the portal. I assume that is because Get ( RecordNumber ) is (although it does display the correct portal row number) calculating the real value of the record as seen from the data file and not the UI file. If I were not using data separation, I could add a calculated field that would know the context of the relationship in the portal, but as there's no way to die the data and UI files together via TO's, there's no way to do this. Correct? Is there a workaround in FM13 to do something like this? I would love if there was a calc boolean calc for 'ActivePortalRow', but alas there's not. Edit: Ah-HA!! Looks like GetNthRecord ( RecordInPortalRow::id ; Get ( ActivePortalRowNumer ) = RecordInportalRow::id ) does exactly what I'm looking for.
March 22, 201411 yr GetNthRecord ( RecordInPortalRow::id ; Get ( ActivePortalRowNumer )) = RecordInportalRow::id
March 22, 201411 yr I find lots of uses for an unstored calc, get( recordNumber) , in many tables. Here's an alternate calc in a simple example file. However, I see that it doesn't refresh properly when you exit the portal. The calc is: IsEmpty( RowRecords::RowRecordID ) or (RowRecords::RecNum <> Get ( ActivePortalRowNumber )) RowButtons.fmp12.zip
March 22, 201411 yr I REALLY like this, Bruce! Consider it stolen!! Is there a specific reason you used the extra set of parentheses, i.e., (RowRecords::RecNum <> Get ( ActivePortalRowNumber )) I'm not trying to be snarky - I really want to know. It is because you think it is more explicit with them on, just that you like them, or were you just in a hurry like we all get at times? !3 absolutely rocks with the new HIDE feature. This is other example of how it can be used to classy effect. Or because it will be evaluated first, it might short circuit and be faster overall if it checks that first. But then wouldn't you just list it first instead?
March 22, 201411 yr Laretta - thanks! Well, the full expression I used is: IsEmpty( RowRecords::RowRecordID ) or (RowRecords::RecNum <> Get ( ActivePortalRowNumber )) I wanted to be sure the second part of the expression is evaluated correctly. Now if we could just figure out the refresh issue so when you click OFF the row the objects hide again. For instance try clicking say on row 2. Then click outside the portal. Row 2 objects remain visible.
March 22, 201411 yr Well, this works although I assume it would be considered a bit of a kludge. I've attached OnObjectExit to the portal and use Preview Mode. RefreshObject[] SHOULD have worked from my understanding of it but nada. As you say, none of the regular refresh techniques work. Just as an aside, in my mind, I would know the calc evaluates correctly because it is split by the OR. Again, thank you for such a great technique! It tickles me! RowButtons2.fmp12.zip
May 27, 201510 yr Thanks for the example files. Seeing these helped me. I ended up using a global variable to reset the visibility on exit. This seemed to redraw a little nicer than toggling back and forth between preview and edit mode. I have attached an example file with the modification. RowButtons_resets_on_exit.fmp12.zip
June 23, 201510 yr Hi All, About refreshing after exiting the portal, I use this combination that I came across by trail & error to refresh the layout and hide the objects: Commit Records/Requests [No Dialog] Show all Records Hope its useful,
June 23, 201510 yr Hi Bruce! I see what you are saying, and you are right!! maybe in cases where the found set is not relevant, its just another easy way!
June 26, 201510 yr Now if we could just figure out the refresh issue so when you click OFF the row the objects hide again. For instance try clicking say on row 2. Then click outside the portal. Row 2 objects remain visible. Hey there Bruce. Been a while my friend. I just looked at your file. I must be missing something ( sorry a little rusty ), but can't you just put an OnObjectExit on the portal itself and then a simple script of: Freeze Window Go to Object ["dummy"] Where dummy is a dummy global field or another field? It worked in my sample ( windows ), dont have a mac to test on. Anyway see you in a few weeks?
June 26, 201510 yr Yup, I'll be at Devcon, thanks for asking. Here a mod I did - way back when this thread was active before - with an on exit trigger which just toggles mode. Interesting that even though it toggles mode it still selects the right row. RowButtons2.fmp12.zip
Create an account or sign in to comment