Jump to content

MaxB.

Members
  • Posts

    18
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

MaxB.'s Achievements

Apprentice

Apprentice (3/14)

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

Recent Badges

0

Reputation

  1. Ok, so I have an invoice thing that calculates the total of the invoice by having a summary field that add up the cost of all the line items on it and displays it in the corner. The problem I have is if I give someone a credit on an invoice it displays correctly in the corner, but in the script that fills out and prints the invoice a value gets assigned to be the summary but it sets the wrong value! I do a credit on a invoice by simply adding a line item with a negative cost, this gets added to the value I have in the corner to show me the total, but on my printed invoices (different layout with different) the total on it is assigned to be the total on my original, but it says too much: The credit does not get added (everything else works). I'm completely stumped, because the total seems to be correct, it's just when I set another field to be the total is gets set to the wrong number. Yes, I realize I could just make the field on the print layout the grand total and not assign it, but sometimes that field is not set to the total, depending on the invoice. Also no, the alternate value is not getting assigned by mistake, it is just the total without the credit being added. Also the total field is an unstored calculation (the one not on the print layout).
  2. Well now I have no idea how this code was "working as intended" before now. This is super old and poorly documented, I don't even know where the numbers in the comparison are coming from. I do know the $$ is being used to pass the var between scripts though. I could change it to a global field probably if using $$ is such a faux-pas.
  3. The calculation: $$category = "11491961930" or "11491971250" or "11491971250" or "47995855093" or "47995855093" is giving me a TRUE no matter what $$category is. I have no idea what triggered this happening since it used to work properly. I tracked $$category in the debugger and it has $$category as a text string containing no numbers in my test cases so I don't know how it would be matching that to trigger the IF statement.
  4. There's no ready-made script for this because to do this efficiently you want to exploit your table relationships. Assuming you have a resonable table stucture (i.e. CustomersTable--<SalesTable>--ItemsTable) you can just make a Summary Field in the Sales table that is the total of Quantity (or whatever you named the field that contains the number sold in Sales). Then make a layout using the Sales table that looks like this: Part Number Item Quantity Sold [ Items::Part# ] [ Items::Name ] [ QtyTotal ] Where the line "[ Items::Part# ] [ Items::Name ] [ QtyTotal ]" is on a Layout Part that is a "Sub-Summary when sorted by" and select Items::Part# as the sort field. Then make a layout that asks for the relevant info and then a script that searches Sales with it (this can actually be really complicated depending on how snazzy you want your interface to be). Then go to the layout I specified above and sort by Items::Part#. You should get a list like how you want. There is a waay to do this using only a script, I've done it, but it's probably the ugliest and most inneficient thing I've ever written. I don't know your skill level so I hope I'm being clear enough. Feel free to ask me to further explain anything.
  5. Cool, putting a Commit Records before the second IF fixed it. Thank you, I would never have thought of that. I have never used Commit Records before, is it good practice to Commit Records after every manipulation step?
  6. It's a calculation with the result as a number. I've sort of figured it out. Earlier in the script Value is used in a different IF statement, and after that Value is changed, and then the IF statement I'm having a problem with happens. I added a dialog pop up showing Value just before the problem IF statement and Value in the dialog box is the same as in the previous IF statement. In other words, Value is being cached when it gets looked up in the first IF and then the same (old and incorrect) value of Value is being used in the second IF statement. I know the changes to Value between the IFs are happening because I see them happen on the layout as I step through the script in Debug Mode. So I guess my question now is how do I get the script to look up the value again instead of just re-using the old one? e: Relookup Field Contents gives me an error dialog and Flush Cache to Disk doesn't work either.
  7. Hello, I have a simple if statement (simplified): If [myTable::Value < 0] [result 1] Else [result 2] End If The thing is, I get [result 2] even if Value is less than zero. The only thing I could think was that on the current layout Value is displayed as part of a text box (i.e. "Some text <<myTable::Value>> some more text"), but testing this by adding a field for Value doesn't seem to fix it. I am completely stumped.
  8. I have made a solution that does this for a register program. Script loop does all setup then pauses, the Enter at the end of the scan unpauses and the loop continues. In this case just do something like: Loop New Record Go to Field [select/Perform; line_items::barcode] Pause/Resume Script [indefinitely] End Loop The scanner NEEDS to append the Enter for this to work though. Also Enter =/= Carrage Return.
  9. Sorry to bump an old thread, but the XSL file attached is almost exactly what I am looking for. The only thing is I also need the first record to be field names. I don't know anything about XML/XSL so I have no idea how to change this myself.
  10. Hello, I am wondering if there is a way to automatically upload an exported .csv file to an FTP server on a Windows PC. I already have a working solution for Mactintosh by running a calculated AppleScript, but I don't know much about Windows and I don't know of any equivalent for PC. The current method I have just calls cURL in the Terminal.
  11. Thank you
  12. I figured it out. I don't have "tell" blocks. The native script worked because without a tell block it assumes to mean you are telling the Finder, but for calculated applescripts it assumes you are telling Filemaker. Changing to : tell application "Finder" --my code end tell fixed it
  13. As the title says I'm having trouble exporting records as a csv file to a file on the user's desktop. The problem I have is apparently these export paths: filemac:~/Desktop/LegAve_Orders/$file file:Desktop/LegAve_Orders/$file Both give a "File cannot be created on this disk" error. I assume because the export paths are not correct. Is there even a way to do this without knowing the user name?
  14. So I have a working native applescript already: set stringToFind to """ set stringToReplace to "" set theFile to choose file set theContent to read theFile as «class utf8» set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, stringToFind} set ti to every text item of theContent set AppleScript's text item delimiters to stringToReplace set newContent to ti as string set AppleScript's text item delimiters to oldTID try set fd to open for access theFile with write permission set eof of fd to 0 write newContent to fd as «class utf8» close access fd on error close access theFile end try I want to eliminate the "choose file" step at the beginning since the file location is in a filemaker variable already, but if I change to it being a calculated script (only major changes in the first three lines): "set stringToFind to """¶ set stringToReplace to ""¶ set theFile to " & Quote($filePath) & "¶ set theContent to read theFile as «class utf8»¶ set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, stringToFind}¶ set ti to every text item of theContent¶ set AppleScript's text item delimiters to stringToReplace¶ set newContent to ti as string¶ set AppleScript's text item delimiters to oldTID¶ try¶ set fd to open for access theFile with write permission¶ set eof of fd to 0¶ write newContent to fd as «class utf8»¶ close access fd¶ on error¶ close access theFile¶ end try" I get the error: "Expected end of line, etc. but found identifier."
  15. I was kind of hoping that it would update in realtime.
×
×
  • Create New...

Important Information

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