July 28, 200817 yr Hello, Here is the situation I have a script that goes to a layout, checks alls the records to see if a defined field is equal to "1" (number field) and if it is it should delete this records. After it has checked all the records, it gets backs to its original layout. The problem is that it seems that the line : 'IF [my_table::my_field = 1]' is working fine in FMP 9 client, but is not working in IWP. So it always gets to the "Else" statement. I've tried different writings such as 'IF [my_table::my_field = "1"]' or : 'Set Variable [$selected, my_table::my_field] IF [$selected = 1] etc, and none works in IWP. If anyone can help me, thank you.
July 28, 200817 yr Author Ok, I haven't found the solution to this exact problem, but I did it differently. I had forgot to mention there was a "find" querry, and I added "my_field" = 1 in the find querry, then I just delete all the found results and I don't need the IF at all. Anyway, the explaination to the original problem would be interesting. Edited July 28, 200817 yr by Guest
July 29, 200817 yr Author Hello, the alternative solution was worse because sometimes (only using IWP) the script did not go to the right form and once it deleted the whole data base instead of just the records I want. So the question remains Why do 'If [$variable = 1]' work in Filemaker Pro but does NOT work in Instant Web Pusblishing (it always goes to the 'else' statement) (The rest of the script work and is IWP compatible.)
July 29, 200817 yr Make sure you go to the correct layout before you find. Your need to be on the correct table occurrence.
July 29, 200817 yr Author Hello, thank you. Anyway I've completely given up the idea to use the multiple layouts to delete things ... it went to the right layout in FMP (100% of time) and to the right layout in IWP (but i'd say only 90% of time) ... Also I haven't found a way to skip the error when there are no records found ... because the script should have been able to find zero records, and then continue, do nothing, go back to previous layout, and end ... but it keep asking for records ... I'm now trying to delete directly in the portal (and it works in FMP, but I've got troubles with IWP) Now, my question remains: Why do 'If [$variable = 1]' work in Filemaker Pro but does NOT work in Instant Web Pusblishing (it always goes to the 'else' statement) (The rest of the script work and is IWP compatible.)
July 29, 200817 yr You need to post a demo of your script. You are doing something wrong, and I'll help, but continuing with pseudo-scripts is a waste of time.
July 29, 200817 yr Author Ok sorry, I'm rather new to FMP. Is there a way to export a script as text ?? Here's the whole script Commits Records/Requests[No Dialog] Go to Object [Object Name:"portal-name" & Get (Scriptparameter)] Go to Portal Row [First] Loop Set Variable [$selected; value:my-table::a-field-that-can-contain-0-or-1] If[$selected = "1"] Delete Portal Row [No Dialog] Go to Object [Object Name:"portal-name" & Get (Scriptparameter)] Go to Portal Row [First] Else Go to Portal Row [Next; Exit after last] End If End Loop Some things may seem useless, but I did not get it to work correctly another way (and relatively correctly in IWP).
July 29, 200817 yr How about: pseudo-code, because on Windows I can't copy scripts: If (not isempty (Parent::Child_marked) using a relationship that not only matches on the parent key, but matches a constant "1" to the checkbox) Go to Related Records (Parent::Child_marked) Show Dialog, "Delete " & Get (FoundCount) & " Records?" 1=Cancel 2=Delete All If (get (lastmessagechoice = 2 ) Delete All Records (no dialog) End If Go to Layout (Parent Form) Else Show Dialog, "No Records Marked for Deletion" End If
July 29, 200817 yr Author Ok, I'll try this next time. For now, can you help me with the script I wrote in my last post ? I mean the script is ok like this ?
July 29, 200817 yr Author Thank you, but if I do not go back to the portal using the "Go to object + Go to first row" commands, when I go to the next row, it goes in another portal. After some tests, I'm still conviced that the IF statement is the key of the problem ...
July 30, 200817 yr Author Well, the "selected" field's type was set to "Text". I set it to "Number" and the problem seems to be solved in my script. Thank you anyway.
Create an account or sign in to comment