kiwiora Posted April 29, 2008 Posted April 29, 2008 Hi, I tried doing a search for this without luck, but am I delusional (quite likely!), or is there a bug with global? Essentially my system is a checkin/out system of assets. A user will have their main processing window and will search and be presented with a list of possible matches that they can then click on to add to their checkout list. So, the user types in their search term into the global, clicks on search. It opens a new window (same layout obviously) and the global disappears??? I have a work around to do the search in the same window then goes back to the original layout and presents the findings in a separate window, but would like to know why this global is not working. Is it a bug, am I using it wrong - I thought globals were across the current file (whether a different window or not??). Hope that makes sense. TIA.
David Jondreau Posted April 29, 2008 Posted April 29, 2008 The contents of a global shouldn't disappear in find mode. However, a global isn't enterable in find mode and cannot be used directly in a search. Since the value of a global is the same across all records, this shouldn't be a problem. What is causing the global to disappear is impossible to say without knowing more about your script.
kiwiora Posted April 29, 2008 Author Posted April 29, 2008 Hi No the global entry is in browse mode, then used in search. Script below : If [ IsEmpty(LoansItemBatch::gSearch) ] Show Custom Dialog [ Title: "ERROR"; Message: "please enter search criteria"; Buttons: “OK” ] Exit Script [ ] End If Set Field [ LoansItemBatch::gID; LoansItemBatch::SerialID ] New Window [ Name: "Check Out Assets - Search"; Height: 268; Width: 823; Top: 250; Left: 250 ] Go to Layout [ “AssetSearch” (Assets) ] Enter Find Mode [ ] Set Field [ Assets::Search; LoansItemBatch::gSearch ] Perform Find [ ] If [ Get(FoundCount) = 0 ] Close Window [ Current Window ] Clear [ LoansItemBatch::gSearch ] [ Select ] Show Custom Dialog [ Title: "ERROR"; Message: "No records found"; Buttons: “OK” ] Else Constrain Found Set [ Specified Find Requests: Find Records; Criteria: Assets::AssetStatus: “=1” ] [ Restore ] If [ Get(FoundCount) = 0 ] Close Window [ Current Window ] Show Custom Dialog [ Title: "ERROR"; Message: "No assets available matching your criteria"; Buttons: “OK” ] Clear [ LoansItemBatch::gSearch ] [ Select ] Else If [ Get(FoundCount) = 1 ] Set Field [ Assets::gSerialID; Assets::SerialID ] Close Window [ Current Window ] Show Custom Dialog [ Title: "ADD Record?"; Message: "Add " & AssetSJoin::AssetDescription & " to record?"; Buttons: “Yes”, “No” ] Clear [ LoansItemBatch::gSearch ] [ Select ] If [ Get(LastMessageChoice) = 2 ] Exit Script [ ] Else Go to Layout [ “LoanRecords” (LoansRecords) ] New Record/Request Set Field [ LoansRecords::AssetSerialID; Assets::gSerialID ] Set Field [ LoansRecords::LoansItemBatchID; LoansItemBatch::gID ] Go to Layout [ “Checkout” (LoansItemBatch) ] End If Else End If End If The last part (i.e if >1 record found) leaves it in the window with the list of found records and allows the user to select the asset from the list which then adds it.
David Jondreau Posted April 29, 2008 Posted April 29, 2008 A quick look, and I'm wondering: -What happens when someone finds a single match but doesn't want to add the asset. You have an Exit Script, but no Close Window. -Why run most of the script in a new window, but then close it and run a part in the original window (when a user chooses the add the asset)? -Two of your globals can probably be substituted with variables instead. But I don't see what issue you might be having with a global "disappearing". Which of the 3 globals are you having trouble with and what behavior are you expecting that isn't happening and under what circumstances does it happen?
kiwiora Posted April 29, 2008 Author Posted April 29, 2008 I tried commenting the script but it didn't work 1.you'll see once it's found records it then constrains to what's available. Then closes the window and asks if they want to add.. if not it exits script. Else If [ Get(FoundCount) = 1 ] Set Field [ Assets::gSerialID; Assets::SerialID ] Close Window [ Current Window ] Show Custom Dialog [ Title: "ADD Record?"; Message: "Add " & AssetSJoin::AssetDescription & " to record?"; Buttons: “Yes”, “No” ] Clear [ LoansItemBatch::gSearch ] [ Select ] If [ Get(LastMessageChoice) = 2 ] Exit Script [ ] Else Go to Layout [ “LoanRecords” (LoansRecords) ] New Record/Request Set Field [ LoansRecords::AssetSerialID; Assets::gSerialID ] Set Field [ LoansRecords::LoansItemBatchID; LoansItemBatch::gID ] Go to Layout [ “Checkout” (LoansItemBatch) ] End If Else End If 2. I run it in the second window so if there's > 1 item found, the user is presented with a list from which they select and it goes and adds it to the booking 3. will look into it.. 4. LoansItemBatch::gSearch is the problem field. TIA
Søren Dyhr Posted April 29, 2008 Posted April 29, 2008 Forgive my cheekiness, but prefixing a field with a g doesn't nessersarily make it global. --sd
David Jondreau Posted April 29, 2008 Posted April 29, 2008 Good point Soren. The first thing you should check if a global isn't working the way you expect is if the field is actually set to global storage. Commenting is easy and should be done with all your scripts. There's a Comment script step for this. 1) Ah, I see. 4) Ok. But what's the problem. Under what conditions is gSearch "disappearing"? What do you mean by "disappearing"? Have you run the script in the script debugger with "Pause on Error" checked.
kiwiora Posted April 29, 2008 Author Posted April 29, 2008 This is true... but I use common sense in my naming : Ya wee cheeky monkey!
kiwiora Posted April 29, 2008 Author Posted April 29, 2008 Good point Soren. The first thing you should check if a global isn't working the way you expect is if the field is actually set to global storage. Commenting is easy and should be done with all your scripts. There's a Comment script step for this. 1) Ah, I see. 4) Ok. But what's the problem. Under what conditions is gSearch "disappearing"? What do you mean by "disappearing"? Have you run the script in the script debugger with "Pause on Error" checked. Sorry, I meant adding a comment into my coding using on bb code, it made the whole thing turn into a comment. e.g If [ Get(LastMessageChoice) = 2 ] Exit Script [ ] Else Go to Layout [ “LoanRecords” (LoansRecords) ] New Record/Request Set Field [ LoansRecords::AssetSerialID; Assets::gSerialID ] //this is a comment ends HERE Set Field [ LoansRecords::LoansItemBatchID; LoansItemBatch::gID ] Go to Layout [ “Checkout” (LoansItemBatch) ] End If I will strip down my file and post it. I'm intrigued as to whether I'm missing something or it is a bug. I have checked it's definately set as global etc.
kiwiora Posted April 29, 2008 Author Posted April 29, 2008 Here is an example of the bug. And as I was writing it I discovered what the problem was : [color:yellow]I had to commit the data before opening it in a new window... :doh: test.zip
Recommended Posts
This topic is 6051 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now