Jump to content

Tony Diaz

  • Posts

  • Joined

  • Last visited

FileMaker Experience

  • Skill Level
  • FM Application

Platform Environment

  • OS Platform
  • OS Version
    Any (6.0.8, 7.6, 8.6, 9.1 etc), OS X, MacOS, macOS

Tony Diaz's Achievements


Enthusiast (6/14)

  • First Post
  • Collaborator
  • Conversation Starter
  • Week One Done
  • One Month Later

Recent Badges



  1. As opposed to the way I have it now. This would be a bit simpler I suppose. I store the text descriptions and titles in a table and then in a separate table, I've got just the ID's in records for each record in the main table that they're associated with. If I just let it store those anyway, using the ID as the key field in that table, it will just update an existing one instead of making a duplicate or having to intercept an error because of a non-unique field entry. The script excerpt above isn't the greatest example, though the flow is the same, but if I went by Game_ID and Caption, I'd never get duplicates there. As a consequence, it means I have to collect all those IDs and titles separately and load that that table first and then ignore them during an API call, just taking the ID's for that particular query. I'm gonna try and work it out, see if I can make sense of it, or post what I run into..
  2. It's been a little while, but something changed a few months back and now all the posts look like this when reading: I'm sure it's that topic status/metric box on the right.. was there before? I can't find a way to change any of this in the profile settings. This blows for looking at scripts and code settings as you can see, it's heavily in need of side scrolling.
  3. That works .. though I'm not 100% sure why, yet. Or.. why I shouldn't just do them all that way. That is, once it clicks with me what is exactly going on there. (I stepped away from this project for a bit, and am back to it again. )
  4. My JSON data contains dates in one of three formats: YYYY YYYY-MM YYYY-MM-DD The field is: Items::Initial_Release Instead of the text, I would like to have it display that as a proper date based on what's there. 1984: Year Only 1984-08: August, 1984 1984-08-08: 08 August, 1984 Based on the available options for formatting the date, I gather that the FileMaker Date format probably can't deal with less than the full amount of data? Or even changing it, having it be Day first if there is full data, otherwise Year, or Year, Month only. Otherwise, it looks like I would have to have the date field in three different formats and use Hide If .. the data is 4 characters, 7 characters, or 10 characters? As well, no matter what I do with those format settings above, I can't enter anything less than 10 characters in the field if it's defined as a date field. I'd like to be able to get things by date in queries, so keeping it as date format would seem to be the better way to make that work.
  5. Also, does it have a time limit on it? .. since it's been a little while now, is it worth messing with? As for HostGator. They use CentOS, so it shouldn't be any issue to do.
  6. A global field ... in the table that is on the layout where the target records are I gather, before the loop happens? Set Field [ Moby_Screenshots_Meta::GlobalField ; JSONGetElement ( $record ; "caption" ) ] ..and something instead of the New Record / Request? I'm not having too much success with finding examples of scripting / updating existing records. I'm having a mental block with it at the moment.. hopefully it will come to me.
  7. I've got this to skip existing records when parsing incoming JSON.. If [ not IsEmpty( $screenshots ) ] Set Field [ Moby_Games_Importer::JSON_VariableView0 ; $screenshots ] Set Variable [ $PLATFORM_ID ; Value: "5" ] Set Variable [ $MOBY_ID ; Value: Moby_Games_Importer::Game_ID ] Set Variable [ $n ; Value: ValueCount ( JSONListKeys ( $screenshots ; "" ) ) ] Freeze Window Go to Layout [ “Moby_Screenshots_Meta” (Moby_Screenshots_Meta) ; Animation: None ] Set Variable [ $existingIDs ; Value: ExecuteSQL ( "SELECT Caption FROM Moby_Screenshots_Meta" ; "" ; "" ) ] Loop Set Variable [ $i ; Value: $i + 1 ] Exit Loop If [ $i > $n ] Set Variable [ $record ; Value: JSONGetElement ( $screenshots ; $i - 1) ] Set Variable [ $caption ; Value: JSONGetElement ( $record ; "caption") ] If [ IsEmpty ( FilterValues ( $caption ; $existingIDs ) ) ] New Record/Request Set Field [ Moby_Screenshots_Meta::Platform_ID ; $PLATFORM_ID ] Set Field [ Moby_Screenshots_Meta::Moby_IDfk ; $MOBY_ID ] Set Field [ Moby_Screenshots_Meta::Caption ; JSONGetElement ( $record ; "caption" ) ] Set Field [ Moby_Screenshots_Meta::Image_URL ; JSONGetElement ( $record ; "image" ) ] Set Field [ Moby_Screenshots_Meta::Thumbnail_URL ; JSONGetElement ( $record ; "thumbnail_image" ) ] Set Field [ Moby_Screenshots_Meta::Thumbnail_URL ; JSONGetElement ( $record ; "thumbnail_image" ) ] Set Variable [ $redirectURL ; Value: Moby_Screenshots_Meta::Image_URL ] Insert from URL [ Select ; With dialog: Off ; Target: Moby_Screenshots_Meta::Screenshots ; $redirectURL ] Set Variable [ $redirectURL ; Value: Moby_Screenshots_Meta::Thumbnail_URL ] Insert from URL [ Select ; With dialog: Off ; Target: Moby_Screenshots_Meta::Thumbnails ; $redirectURL ] End If End Loop Go to Layout [ original layout ; Animation: None ] End If .. but if I want to update existing records? Would that need to be a search for each record, or is there a mode where it can act like it's using the import / update function?
  8. I actually don't care about the order of their selection. It was more of a precursor to "They're going to be listed in that order due to the way FileMaker works" so that does not matter to me. On the values being listed from the 2nd field, I don't care what the order is at all. I'm trying to duplicate this kind of display of whatever choices I've selected: Platforms and Genre each have multiple options selected. So they're separated by commas. The others in this example are each single values. Otherwise, right now I'm doing it manually when adding them: Clicking in the field, typing ",<space><ESC>" which gets the drop down values to show again and then picking the next desired one. But of course, I can't pass back changes in the Value List values to those fields.. ... on the first part. D'oh. Replace return/pilcrow with ", " in a non-stored calculated field.
  9. If I want to create a new record during a script, I need to select the layout that is associated with that desired table.. (Freeze Window.. create new record .. in the background) .. But if I just want to set fields in a particular table (set field Table::Field), If I do not change the layout, will those changes always be on the same / last record accessed on the non-visible table?
  10. This is a two part question: A Checkbox Field is the selected options from a Value List separated by a return (¶) So if I have a Value List where the options are Alpha, Bravo, Charlie, Delta ... and I've selected three of them, the field will be stored as: Bravo¶Delta¶Alpha Or visibly: Bravo Delta Charlie What I'd like to do is re-format the display of those values as "Bravo, Delta, Charlie" (obviously in the order selected, as the standard way value lists populate the fields) In the sample Filemaker file attached, the blue text are examples of how I'd like to see the choices displayed.. It's likely some kind of calculation with concatenated values? .. The top example where the value list is straight forward using the text values. The second row is using values that would be related by their IDs so that the ID's would stay the same, but any value assigned to them would change globally, and also be formatted in either way. Value, Value, Value Value Value Value The workflow here is the tick boxes would be on the admin side of things, while the blue text is on the display / reporting side. You can choose from the available options during inputting, but for displaying they only see the selected options. The Value List here is based on stored values in a table, with their associated ID. ValueListSandbox.fmp12
  11. Okay, that takes care of that problem. Though, Generator does help with the repetitive bits of setting up script steps and matching them up with their fields/tables.. (which is actually a pretty cool thing in itself!) but it does come across as over-complicated if you don't know whats going on first. Not looking a gift horse in the mouth at all, but at least in my case, it made -a lot- more sense what it's doing after I understand the steps needed to do what it's doing in the first place. It makes setting up the -next- one an absolute breeze ... because I don't have to do it one field at a time. Thank you for that! Between Generator and the Tool that I've got based on an earlier thread/reply from @comment .. I can both break down the data I'm working with easily and use Generator beside it to set up those repetitive steps. (declare variable to parse, write the line, goto the Table, create, Field, create/copy script Line, Assign/change values, wash, rinse, repeat. ) ... that's just too cool. But for working it out the first time, I did the fields/script lines/etc. all one at a time as I got one field working at a time. --------- As for the issue of this thread, it appears to be the counter variable ($i / $y). $i being the counter in the first loop, and $y is the counter in the sub-loop (embedded array). $i maxes out at 10 as JSONListKeys returns 10 lines. So it does all those fields with flat values. It then reaches the first JSON key that represents the first embedded array, and that JSONListKeys count is 3. Using the -proper- incrementing value, this works, it goes through and creates the 3 related records for this field. Reaches the end of that array, and exits the loop. ($x = 3 at this point) ... the rest of the fields in the initial loop finish, the loop exits .. ... and the whole thing starts over on the second of 10 records. ... the first part happens, (Lines 1-31, the inner loop starts again and the sub-array, which for this second record, it's got 4 keys. One more than the previous time around. But .. it appears $y is still.. ($y = 3) it will exit the loop at line 34 on this second time around. Looks like I should insert $y=0 at line 42. Set Variable [ $y ; Value: 0 ] $i will of course, never pass 10 before the entire script is done with, so that one will never have the same issue. As such, it all works with the added reset of $y to 0 at the end of the sub-loop. Now I can go add in the other 3.. Plus the other piece of script to check if some of these values exist in the first place, to not create duplicate records in the value list side of things.
  12. I can pick a file, but then there's never any tables to pick from. If I enter the name of an existing table, it tells me the file isn't open. I'm going through the video again now. Hmm.. yup, I see that. I went over those and still missed that. Interestingly, changing it doesn't change a thing. The line to get the amount of keys works, the proper chunk of code is in the $GENRESARRAY variable.. It's kinda like the layout is acting like a portal showing weird values due to funky relationship values. I can pick the file.. But I never get a list of tables to choose from. ... entering anything, existent or not in that field, and I get
  13. I've tried to get Generator to work.. and the BE plugin is installed.. I still get errors.
  14. Here's the way the data is formatted. https://drive.google.com/file/d/1FJCCf0yKNeEoWfVVOVwAILFoZEGhqJ_b/view?usp=sharing The red columns are Single Records, there's 10 red lines. That's the main Array that's being parsed. Set Field [ Moby_Games_Cache::Genres_Array ; JSONGetElement ( $record ; "genres" ) ] # Insert Array for Genres Set Variable [ $GENRESARRAY ; Value: JSONGetElement ( $record ; "genres" ) ] If [ not IsEmpty ( $GENRESARRAY ) ] Set Field [ Moby_Games_Cache::Field 12 ; $GENRESARRAY // JSON_Parse_Sandbox::Game_ID ] Set Variable [ $x ; Value: ValueCount ( JSONListKeys ( $GENRESARRAY ; "" ) ) ] Set Field [ Moby_Games_Cache::Field 13 ; $x ] Go to Layout [ “Moby_Genres_Meta” (Moby_Genres_Meta) ; Animation: None ] Loop Set Variable [ $y ; Value: $y + 1 ] Exit Loop If [ $y > $x ] New Record/Request Set Variable [ $array ; Value: JSONGetElement ( $GENRESARRAY ; $x - 1) ] Set Field [ Moby_Genres_Meta::Moby_IDfk ; JSONGetElement ( $record ; "game_id" ) ] // Set Field [ Moby_Genres_Meta::Name ; $GENRESARRAY ] Set Field [ Moby_Genres_Meta::Name ; JSONGetElement ( $array ; "genre_name" ) ] Set Field [ Moby_Genres_Meta::Category ; JSONGetElement ( $array ; "genre_category" ) ] End Loop Go to Layout [ “Moby_Games_Cache” (Moby_Games_Cache) ; Animation: None ] End If Set Field [ Moby_Games_Cache::Moby_Score ; JSONGetElement ( $record ; "moby_score" ) ] End Loop end If Within each record, there are four fields that are themselves an array: Those are the colored groups. This sub-array I'm not having success with extracting within it's own loop. In the script above: Set Field [ Moby_Games_Cache::Genres_Array ; JSONGetElement ( $record ; "genres" ) ] This line gives me the $genres sub array for that individual record. I'm assigning it to $GENRESARRAY just like the whole larger blob is assigned as $GAMESARRAY at the beginning of the script. Then I'm doing the same thing, setting a variable, $x, to the amount of keys in $GENRESARRAY. This should happen once each time the larger array loops. It's appears to be happening just 1 and a half times. ...and $GAMESARRAY has 4 fields in it, of which I'm extracting two of them. Name and Category. This is where it seems to be sort of working, mostly failing... Then after that loop is done, it should continue on with the rest of the larger $GAMESARRAY. Which it does.
  • Create New...

Important Information

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