Jump to content

NCB

Members
  • Content count

    23
  • Joined

  • Last visited

Community Reputation

0 Neutral

About NCB

  • Rank
    member

Recent Profile Visitors

994 profile views
  1. Actually, I just found another way to accomplish this. I export the data with "Export Records," create the header in a variable $header, open the exported file with Scriptmaster, then write the header and the exported data back into that file. It's a roundabout way to do it, but it works!
  2. Oh, that is a good idea. How do you get the "Export Records" step to append? I imagine that you first export your custom header to the file using "Export Field Contents", then export the records to the same file with "Export Records?" I imagine one could create a temporary table to populate, then just export that, but I'd like to stay away from creating new tables, if possible.
  3. I have several tables which I want to export to a TSV, but I wish to include a custom header at the top of the actual exported data. This custom header is comprised of the field comment of each field, NOT the field names themselves. Currently in my export script, I am adding the custom header row to the actual data, sorting it to the top, exporting, then deleting it. However, there seems to be a problem when users run the exporter concurrently, and actual data rows are being deleted occasionally instead of the headers. Because I can't figure out how this is happening, I want to eliminate the need to delete records at all in the export script. My new idea is to generate the custom header inside a global variable, use the standard "Export Records" script step, then somehow tack the two together inside filemaker, perhaps with ScriptMaster. There is a problem with the ordering of the columns, as that is determined by the export order when "Export Records" is run, but I am filling a value list with my standard export order and generating the header based on that. I could just concatenate all the rows into a variable and write that to a file as well, but that is much too slow. Any ideas on how I can accomplish this? Is there a faster and/or simpler way to do this than my proposed method?
  4. I implemented your solution, Fitch, and it works well for most tables, but I came across another problem. Â I have a few tables that are not directly connected to the ExtraData table -- they are connected to it via another relationship. (See attachment ). ExtraData's key, IntermediateTable's key, and the Tables' key are the same. Note that both ExtraData and IntermediateTable's key field are set to "Auto-enter serial, Unique, Allow Overrride." Â On the tables that have this arrangement, I get an error that says: "key defined to require a value, but it is not available on this layout. Use another layout to assign a value to this field" when creating a new record (which then attempts to create a new ExtraData record). Â I think that because the keys on each table have validators, the error is being thrown when IntermediateTable's key is trying to override ExtraData's key. Is this correct? Is there a way to fix this? I removed the "Unique" validation on IntermediateTable, and everything seems to work now, but I need to keep the "unique" validation for other reasons.
  5. NCB

    Perform script on background window

    Awesome, that works! While it is a hassle to have to save the original location in several variables, this is a much better solution than anything I have tried. Thanks!
  6. This seems like something that should be possible, but every time I try it, it does not work. I have a script that goes to each layout in my database. When doing so, it flashes and looks really ugly, so I want to 'hide' this window in the background while the script works on it, and create a new window with a "working" layout that remains in the foreground. Unfortunately, whenever I make a new worker window and "Select" it to bring it to the foreground, the script starts executing on the worker window. The script needs to only work on the original window, while the worker window is in the foreground. I have also tried using "Freeze Window" on my main script to get rid of the flashing, but the script has "find" steps that seem to refresh the window. Is there a way to hide or "background" the window on which the script is running?
  7. This has been stumping me for a long time, and I am sure I am overlooking something incredibly simple. Hopefully I can explain this well enough.  I have a relationship between several tables (see example ).  Whenever a record is created in any of the three related tables (Table1, Table2, Table3), I want a new ExtraData record to be created with the same key as the record in the related table. I also want the userValue to be set to the value of a global variable I have $$curUserValue, only if the ExtraData::userValue is empty. If the ExtraData record exists, the ExtraData::userValue changes, AND the key changes, the ExtraData::userValue should just be updated.  Right now I have an onRecordCommit script on the three tables' layouts that creates a new ExtraData record with the current record's key, if such a record does not already exist. It also sets ExtraData::userValue = $$curUserValue. This works fine, but if the related table record's key changes, then a new ExtraData record is created with the new key and $$curUserValue. The problem here is if the ExtraData::userValue field has changed, along with the key, it gets overwritten with the original $$curUserValue.* I want to keep it the same as what it was before the key change.  There must be a much easier way to accomplish this, but the solutions escapes me. Any ideas?   *I am NOT concerned with the orphan records this creates, as I have a script to clean those up.
  8. Oh, I did not know about that script step. Thanks for pointing that out!
  9. Currently I have a script that downloads images from a web location using the Troi URL plugin (The TURL_Get function). I want to replace the Troi function with a ScriptMaster function. Is there an existing one that will allow me to get raw data from a URL? Thanks!
  10. Oh, duh. I am sorry, I was in a hurry yesterday and accidently clicked open the compressed folder to the file. DX Thank you, mr_vodka, that script worked! While it does only work after a commit, and I'd prefer it to run as soon as a record is created, it should still be fine. Thanks!
  11. No, I couldn't see the script because the file was read-only and I couldn't look in the script manager. Could you type the script out here? I think I understand what I need to do, but I can't figure out how to check if a matching related record exists. Also, if I modify a field in the related table with a key that does not yet exist, will that create a record with that key?
  12. But how would this script you reference be called? I want it to only happen when a record is created, and there is no "OnRecordCreate" script trigger.
  13. I am just entering data, not a calculation. Right now, as a test, I am just auto-filling with "1"
  14. I have a table (table1) that is related to another table (table2) by its key. When a record is created in table1, a new record is created in table2. This is defined by their relationship. I want the new record in table2 to have some checkbox fields auto-populated.I have tried using the auto-fill option for the specified fields in the related table, but it is not working. The only thing that seems to work is a script with some "Set Field" calls to those fields, but I have only found an "onRecordCommit" script trigger to run this, and I need to to run as soon as the record is created. Is there a better way to do this? Thanks.
×

Important Information

By using this site, you agree to our Terms of Use.