Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Administration Forums - Upgrades
Forum to discuss upgrading SalesLogix from version to version. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to Upgrades | New ThreadView:  Search:  
 Author  Thread: Converting vbScript to v7
John Gundrum
Posts: 632
Top 10 forum poster: 632 posts
 
Converting vbScript to v7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Nov 06 2:22 PM
fiogf49gjkf0d
I am not sure what it is that I'm doing wrong here. I upgraded a development database to v7 and I just started working on updating a couple customizations. In the account detail form I added two buttons, one that calls a custom script that looks up the account name on Yahoo. The second button does basically the same thing with one small difference. It calls Yahoo News with the account name. Sounds simple enough and was working fine under 6.2.1.

What I did was opened the v7 Account Detail form and my custom Account Detail form from 6.2.1. I copied the two buttons from the old form and pasted them into the v7 form. Simple enough. Now I copy over the scripts from the old form to the new form. Again pretty easy and the code is below
Sub cmdYahooLookupClick(Sender)
CallYahooLookup txtAccount.Text
End Sub

Sub cmdYahooNewsClick(Sender)
CallYahooNews txtAccount.Text
End Sub

As you can see this calls two custom scripts found elsewhere. At the top of the Account Detail form script I have a
'Including Script - System:C_CustomScripts

to include the custom scripts. I figured if I put the scripts alone like that I could use it anyway just by using the include - less repetitive code and makes changes easier. The c_CustomScripts code is as follows
' Custom scripts
option explicit

Sub CallYahooLookup(Account)
Dim strURL

strURL = "http://search.yahoo.com/bin/search?p="

If Account <> "" Then
strURL = strURL & Account
Application.BasicFunctions.WebOpen(strURL)
ErrorCheck Application.Translator.Localize("Error opening web browser:")
End If
End Sub

Sub CallYahooNews(Account)
Dim strURL

strURL = "http://search.news.yahoo.com/search/news?p="

If Account <> "" Then
strURL = strURL & Account
Application.BasicFunctions.WebOpen(strURL)
ErrorCheck Application.Translator.Localize("Error opening web browser:")
End If
End Sub


Ok... so... After I get everything updated I go to test it. I click the company name web lookup button and immediately get this error msg
An error occured executing active form script (System:Account Detail). Error calling method cmdYahooLookupClick
Type mismatch: 'CallYahooLookup'

Ok.. Nothing seems out of place. So I try releasing the old 6.2.1 Account Detail form. When I try each button they work perfectly!?!?!???!? So I unrelease it and try something with the new version. I copy the code from c_CustomScripts and paste it directly in the Account Detail script. Now I test and the one button works... but the other button just clicks. Doesn't do anything. ?!?!?!??!?! Ok.. so this is bugging me now..

Does anyone have a thought on what it is I am doing wrong here?

Thanks,
John G.
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Converting vbScript to v7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Nov 06 3:02 PM
fiogf49gjkf0d
Is SLX Error Support (or whatever it's called now) included in c_CustomScripts? That would explain why it works under Account Detail, since the script is included there. If that's okay I'd then place a MsgBox stringURL before Application.BasicFunctions.WebOpen and comment the line out. That'll help you determine if the string being passed is valid or not.

I've been working in VBScript for a good 2 years now and it never ceases to amaze me how I miss the simple things, even when I typically gut working customizations to form new ones.
[Reply][Quote]
John Gundrum
Posts: 632
Top 10 forum poster: 632 posts
 
Re: Converting vbScript to v7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Nov 06 10:47 AM
fiogf49gjkf0d
I must be doing something wrong here. The error message is telling me 'CallYahooLookUp' is a Type Mismatch. So I'm taking it that its treating 'CallYahooLookUp' as a variable and not a Sub call. What am I doing wrong?

This is the code calling the sub

Sub cmdYahooLookupClick(Sender)
CallYahooLookup txtAccount.Text
End Sub


Thanks,
John G.
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Converting vbScript to v7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Nov 06 2:25 PM
fiogf49gjkf0d
Quote:
Originally posted by John Gundrum

I must be doing something wrong here. The error message is telling me 'CallYahooLookUp' is a Type Mismatch. So I'm taking it that its treating 'CallYahooLookUp' as a variable and not a Sub call. What am I doing wrong?

I've had errors that would appear in the wrong location. The error would appear in one routine but the ErrorCheck() call from another routine would pick up Err.Number and report it erroneously. For this reason, I place an ErrorCheck() call at the end of every routine to flush everything out and make sure all routines start at square one.

I hate to sound like a broken record, but did you make sure SLX Error Support was included in c_CustomScripts or wherever ErrorCheck() is called? I've had instances where not properly including scripts at every level caused weird inheritance issues.
[Reply][Quote]
John Gundrum
Posts: 632
Top 10 forum poster: 632 posts
 
Re: Converting vbScript to v7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Nov 06 2:43 PM
fiogf49gjkf0d
Yes. SLX Error Support was added to c_CustomScripts. Doesn't seem like its even getting there. I click the control which calls cmdYahooLookupClick which in turn calls CallYahooLookUp.

Still stuck.. although I will try a couple more things... like try calling CallYahooLookup directly from the control and see where that gets me

Thanks,
John G.
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Converting vbScript to v7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Nov 06 2:56 PM
fiogf49gjkf0d
Try placing ErrorCheck() before and after the CallYahooLookUp call. If that doesn't help, place them further down the execution chain in as many places as possible. I've been known to throw a lot in my big routines just to keep everything sane along the way. It shouldn't be necessary as a long term thing for what you're doing, but it is a good way of figuring out exactly where something hiccups.

The only other thing that comes to mind is the use of Account as a variable. It should be possible but I've always made a point of using full names like stringAccount so I know exactly what kind of variable it is.
[Reply][Quote]
John Gundrum
Posts: 632
Top 10 forum poster: 632 posts
 
Re: Converting vbScript to v7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 14 Nov 06 7:11 AM
fiogf49gjkf0d
I'll try the ErrorCheck() before the call. I've already converted the 'Account' variable to strAccount.

There must be something I'm missing altogether here.

Thanks,
John G.
[Reply][Quote]
Rick Smith
Posts: 96
 
Re: Converting vbScript to v7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 15 Nov 06 7:18 AM
fiogf49gjkf0d
Just wondering if the control txtAccount exists on the new v.7 form?
[Reply][Quote]
Carla Tillman
Posts: 290
 
Re: Converting vbScript to v7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Nov 06 10:18 AM
fiogf49gjkf0d
John,

One other thing to check; The order your includes are in. If you have an Option Explicit notated and the subs are compiled before the DIM statements wheather they be inline or includes, you can get these types of errors thrown.

c
[Reply][Quote]
John Gundrum
Posts: 632
Top 10 forum poster: 632 posts
 
Re: Converting vbScript to v7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Nov 06 10:59 AM
fiogf49gjkf0d
I moved the include around and for Rick... yes... txtAccount does exist.

The code in question is very simply...

Sub cmdYahooLookupClick(Sender)
CallYahooLookup txtAccount.Text
End Sub

Its not looking at CallYahooLookup as a sub. Its thinking its a variable?!??! Do I have to call it explicitly like.

DO CallYahooLookup

or

Call CallYahooLookup

??

John G.
[Reply][Quote]
Carla Tillman
Posts: 290
 
Re: Converting vbScript to v7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 16 Nov 06 11:42 AM
fiogf49gjkf0d
Did you try some simple things like

dim myVar
CallYahooLookup MyVar


Or Renaming the Sub to remove the reserved word Call? That one is really really reaching, but hey...

c
[Reply][Quote]
John Gundrum
Posts: 632
Top 10 forum poster: 632 posts
 
Re: Converting vbScript to v7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Nov 06 9:46 AM
fiogf49gjkf0d
I am fairly certain I know why this won't work. But I am not sure how to fix it.

I finally created a project for this and added the Account Detail form to it. In the process of doing this I noticed all of the includes listed in the form script were automatically added to the Project. All but the one script I told it to include?!?!?!??! So the problem is not the code or anything... its the include?? The beginning of the script is as follows:
'Including Script - System:SLX Database Support
'Including Script - System:SLX Error Support
'Including Script - System:SLX Lookup Support
'Including Script - System:SLX CTI Support
'Including Script - System:SLX Address Common
'Including Script - System:Spell Check
'Including Script - System:CTS_CustomScripts

Now I've also tried moving my include to other areas in the list of includes with no luck. I checked the plug-in manager and my CTS_CustomScripts is a member of System.

Any ideas why my Include isn't working?

Thanks,
John G.
[Reply][Quote]
Carla Tillman
Posts: 290
 
Re: Converting vbScript to v7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Nov 06 10:18 AM
fiogf49gjkf0d
Weird!!

Long shot: Did you remember to release your Custom Script? Did you write the script in the SLX editor?

I would probably bring the script back in line and verify wheather it is the include or the actual code where the problem resides.


Here is one other thought that occured to me. have you tried moving these subs to functions?

FROM the ACC_FORM:
Dim strURL
strURL = txtAccount.Text
' optional call if not isnull(strURL) then ... you would not need to check it at function call thus preventing possible error throws.
CallYahooLookup(strURL) 'strURL starts as Accountname then morphs to desired URL compocite
Application.BasicFunctions.WebOpen(strURL)
ErrorCheck Application.Translator.Localize("Error opening web browser:")


********************************************
FUNCTION CallYahooLookup(strURL)

If strURL <> "" Then ' You could also use len(strURL) > 1
strURL = "http://search.yahoo.com/bin/search?p=" & strURL
CallYahooLookup = strURL
End If

End FUNCTION



c
[Reply][Quote]
Jeremy Brayton
Posts: 491
Top 10 forum poster: 491 posts
 
Re: Converting vbScript to v7Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Nov 06 1:17 PM
fiogf49gjkf0d
Have you tried running SLXProfiler.exe against Architect to see if it's returning any squirrelly SQL? Perhaps it's having a problem with the "script" in the name? Wouldn't be the first time a reserved word snuck through.

Try profiling a project you know works perfectly and compare it with the offending one. While you really shouldn't have to compare them (the existing project importing any record is enough), you want to at least make sure something internally isn't screwing it up.

Make sure CTS_CustomScripts doesn't have a large number of nested includes, like including another script that has SLX Database Support while it also has it, along with your Account Detail form. Nesting of this nature shouldn't be a problem but there may be a special case in the hierarchy that's being a punk.

Lastly, has CTS_CustomScripts been saved a lot? There was a ceiling in previous versions of SLX where something like any plugin over 255 saves wouldn't work correctly unless you saved it as a new name. Plugins have an internal version that increments with every save of the plugin version (it's showin in properties, usually 0.x). While saving as a new version resets this number, if you never save new versions it may be likely you'd hit this ceiling. If I had to guess, this problem no longer exists but I have seen it personally with legacy plugins (pre 6.x).


The problem now as I recall is the CustomScripts. Your functions worked perfectly when applied directly to Account Detail but for some reason don't work when placed in their own script. The type mismatch error you get is indicative of the script not being parsed for some reason (though type mismatch error could mean a number of different actual problems). So if I have everything correct, it looks like you've narrowed the problem down. Now comes actually fixing it. Hopefully profiling Architect may point you in the right direction.
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/26/2024 2:08:08 AM