0

Table context

Let's say I have a child table with 2 parent tables. When acessing the child table through either of the parents (as opposed to directly from the table list on the LHS) in order to e.g. add a child record, how can I tell from which parent I arrived there?

 

I've not been able to figure out how to do this, even by setting some variable in each parent that can be read when opeing the child's form. Is there a Ninox function for this, or has anyone figured out how to achieve this?

3 replies

null
    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    This might not give you a perfect answer as I am sure those who are much cleverer than me can offer a better sulution! (Steven, John etc)

    but I pass the tableID from the parent down to the child table using tableID. Explanation below at the foot below.

    I use a formula and express it as this

    let myT := tableId(this);
    if myT = "NB" then TableNameField :="Quotes" end

    as in Quote being the parent table- I then look at the result file in the parent form the child table Quotelines (child)

    it is that parentname file that I read from from formula field in the child table

    might help - err might not :-)

    ---------------------------------------

    Blurb from 0001 Ninx reference DB

    With the function tableId() the internal identifier of a table of the currently opened database can be read. This identifier, consisting of one or two capital letters, has been part of the URL since version X.X and can be used as an identifier for API actions. For normal Ninox usage it has no meaning.
    For internal administration, Ninox assigns a letter to each newly created table in alphabetical order from A to Z. If there are more than 26 tables, a second letter will be added, the next table would get the identifier "AB", then "BB" and so on. The IDs of deleted tables are not reassigned.
    The tableID is also part of the complete record ID, which can be read with raw(this). For example, "K13" would be record no. 13 in table "K".

    eg TableID(this). .... or TableId (Quotes) etc

    • UKenGB
    • 2 yrs ago
    • Reported - view

    Ok, I think I get that. The parent table formula field will contain its table name if I access the child table through that parent. However, the other parent table's formula field will be empty. So in the child I can look at both to determine which parent was used. Yes?

     

    That should work for me. I'll try that. Thanks.

    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    Yeah that's the idea - I only need to see the parent info in my child table but it should do what you want. As said it may be a bit crude but it for works for me. I'm sure there will be a more elegant answer still to come.

Content aside

  • 2 yrs agoLast active
  • 3Replies
  • 300Views