FAQ
R
Leo,

Thanks for responding, however, as I suspected, no dice. I'd tried both popupRecord and openRecord and neither did anything for me.

The issue is that there's something not working with the internal Id column and it's not populating correctly.

For the record I tried out this simplified code:

let p := (create Photos);
p.Type := 2;
p.Title := "Test #1";
let myID:=p.Id;
popupRecord(record(Photos, myID))


The record is created correctly but the Id is not visible at this point in time. In fact I'm pretty sure it's always set to empty when the code runs. As a result the popupRecord ‘fails’ to run (because it has no Id value).

If I hardcode the myID value to the next known Id value then all is good; e.g this ‘works':

let p := (create Photos);
p.(Type := 2);
p.(Title := "Test #2");
(let myID := 36;
popupRecord(record(Photos,myID)))


To go one better and further illustrate the issue, consider the following:

let p := (create Photos);
p.(Type := 2);
(let myID := p.Id;
p.(Title := "Test #8");
p.(pid := myID);
popupRecord(record(Photos,41)))


When this runs the form opens correctly (owing to the hardcoded Id #) however, there is nothing in the numeric pid column which I’ve now added to the table to further try to ascertain what’s going on here.

However this also ‘works':

let p := (create Photos);
p.(Type := 2);
(let myID := 42;
p.(Title := "Test #9");
p.(pid := myID);
popupRecord(record(Photos,myID)))


When I run that, I get the text Test #9 in the Title column, value, the 42 value in pid column AND the record opens up correctly.

So, to conclude, the issue has nothing to do with the openRecord or popupRecord functions, and everything to do with the Id column not being populated correctly during the create statement.
R
I was also able to replicate the issue with a brand new database which I created just to test this out. In addition the issue seems to effect both the OSX and the IOS versions of Ninox.
C
I can confirm this issue. Is a solution anticipated?
Ninox Profile
Please try it

let p := create Photos;
p.Title := "new";
p.Typ := 2;
let MyID := number(p.Id);
popupRecord(record(Photos,MyID))

Id field is at Ninox declared as text. PopupRecord expects a number as Id
Leo
R
Leo,

At first blush I think this is working, but I'll need to look at it more when I've more time later today.

Thanks!

R
R
Leo,

Success!

Here's the final code I ended up with:

let _here := Where.Name;
let _date := Date;
let _p_ := (create Photos);
_p_.(Type := 2);
_p_.(Title := _here);
_p_.(Date := _date);
(let _id := number(_p_.Id);
popupRecord(record(Photos,_id)))


I'd love to know a couple of things though:

1: Why does Ninox insist on some of the parentheses it adds to my code - the only ones I added where in the second and last line. It decided to add them everywhere else.
2: It seems like I have to fetch current form values into a variable before I can use them in an assignment here. For example, if I try to do the following:

p.Title := Where.Name;

Ninox balks and gives me the following Error: Field not found: "Where" at line 5, column 16

That said, I know now the gotchas around this functionality and I can live with them, despite the fact I don't fully understand the reasoning behind them.

Thanks so much for the assist!

R
C
That works. Thank you. The representation of Id in the visual formula editor implies that it's a number.
C
This works on the mac and iPad versions but not on the iPhone version. Is popupRecord not supported on the iPhone version of Ninox?
R
OK, now got something totally different that's puzzling me.

I have two connections to the Photo's table I've been setting up all weekend: 1 that stores a menu and one a picture of a meal. Both those now work 100%.

To display each image in the appropriate location on the form I have a formula that looks something like this:

Menu_Photos_.Image

and

Meal_Photos_.Image

Again, both these work perfectly.

That said, if I try to display them on a view then Ninox first converts the function to an image type (which I guess makes sense), but then subsequently just drops them from the view when I save it.

This happens if I drag the formula's to the list of columns or if I create a formula to do the same.

Can Ninox not display images in views referenced by other tables?
R
Heh - just sussed it:

first(Menu_Photos_.Image)

Guess Ninox is more forgiving in the form because it displays OK there without the first() function but is more anal in the view.
Reply