Filemaker: Copy Global Variable from a Related Table? - copy

I have a parent table that contains a global variable named gStartDate.
In a child table I have placed a global variable with the identical name. It has a calculated value:
ParentTable::gStartDate
However, it appears that it never copies the date from ParentTable::gStartDate. How can I correct this?
Thanks in advance to all for any info.

Its sounds like you set the calculated field in the child table to use "global" storage. That isn't going to update unless you update the schema or create a new record in the child table.
What you want is to set the calculated field to in the child table to be "un-stored". That will update when it is needed. And when it does it will pull the correct result from the parent table.
See the image.

Related

Change the table's binding

I need to change the binding of my table when i click on a button and it is working when the table is not empty but if the table is empty it is not working
i tried this solution(because the table is already defined in xml) and it is partially working
oTable.bindItems("/CarsSet", oTable.getItems()[0].clone(), null);
the problem is when the table is empty it is not working since oTable.getItems()[0] is undefined
one cheap solution is to clone the first element template and save the reference when the Table has been rendered the first time. After that you can use it when you change the binding otherwise (if the table is empty) you will get that error.
The template item should be defined in the dependents aggregation. This way you can always clone it regardless of the state of the binding.
You can refer to this sample to check how dependents works.

Filemaker Pro 14 History tables

With a few solutions Ive worked with I've created temp table's or history tables. Normally I script it to take a handful of fields needed from a main table and copy it over to the other table by
Setting a variable then setting field to the variable for each field in the new table / new record.
I have a situation now, where Im building a history table that needs to copy the current record as is. A snapshot where all fields from that instance of the record are copied to the history table.
Rather then setting a variable then set field to the variable, Id like to get some input on a quicker way to get this done where I can do this on a record level and not type out field by field to get it done. Also if fields are added to both tables then I have to make sure my script gets updated.
Ill keep hunting around.. appreciate any help.
-Rich
Do you have a sample of copying a record from 1 table to another
including all fields and setting some fields?
As I suggested in comments, use the Import Records[] script step, and select the same file as the source. If you choose Arrange by: [ matching names ] in the Import Field Mapping dialog, it will automatically map all source fields to their similarly named counterparts.
Note that you must establish a found set in the source table before importing.
For "setting some fields", you can define auto-enter options and activate them during the import, or run Replace Field Contents[] immediately after the import.

I would like to use a parameter for the table name. The table names can be presented to the user from a database view.

I would like to use a parameter for the table name. I have an application that creates several new tables each month. I therefore need the table name to be sent into CR via a parameter. The fields for the tabkes are always identical. I can present a list (view) from the database to the end user that would display a user friendly name for the table, when the user selects the instance they want I then have the table name I want to report from.
I'm not sure if that is possible. Even if your tables have the same structure, the field names will ultimately be different. Let's say you have a {table1.field1} in your report. Now you want to run the report from table2 instead of table1. So your field now would have to become {table2.field1}. Does that make sense? I think a better approach might be to try stored procedures that will create the fields you need so the field names won't change.

TSQL - force update of persisted computed column

I have a persisted computed column in one table with the value calculated using a user function. How can I force that column to be updated without updating any other column in that table?
UPDATE: So as it turns out, this will not work as I imagined it.
I wanted to have user function that contains sub-query in it, gets me some data and stores it in computed column. But SQL Server won't allow this...
It looks like I will have to do something similar with insert/update triggers.
If you persist the value by adding the PERSISTED keyword, the value is both retained on insert and will be synchronized when the referenced column is updated.

I want to Dynamically access SQLite result set?

I want to dynamically access SQLite result set. Since webworks/javascript doesnt support "PRAGMA table_info(table_name); I am saving all newly created tables information in a single two column table called schema. schema has two columns, table_name and column_name.
So I created a function to access table data dynamically. I use the item=results.rows.item(i) and than access row data with item.column.
column is a variable that is assigned the value from schema, representing the column_name. When I alert(column) I get the correct column_name, but when I used item.column my results are "undefined".
any advice on how to resolve this matter.
If I understand you correctly, column is a variable that holds the value of a column name, and you want to access that column from the results item. If that's the case, then this might help:
//Assuming "var column" has already been defined,
//and given the value of the column name to be accessed in the results item.//
var item = results.rows.item(i);
var columnValue = item[column];
I struggled with this too, and this is what I found/use. You put in brackets the variable containing the column name, and that's how you access it.
EDIT: This is obviously Javascript stuff, and what I used for accessing SQLite in PhoneGap. Hopefully it helps.