8/28/2025 5:27:10 PM
|
|
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!
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
new problem - SLX3.10
Posted: 25 Apr 09 8:30 PM
|
Can somone tell me why this code does not work?:
Handle = DBOpenTable("vendor", False) DBInsert Handle
DBSetValue Handle, "vednorId", vend_ID DBSetValue Handle, "CreateUser", CurrentUserID DBSetValue Handle, "CreateDate", Trim(Date) & Trim(Time) DBSetValue Handle, "vend_name", GetPropertyOf("EdtBx1","Text") DBSetValue Handle, "ModifyUser", CurrentUserID DBSetValue Handle, "ModifyDate", Trim(Date) & Trim(Time) DBPost Handle DBClose Handle
No error messages and no new records in the table.
I just checked " DBExecuteSQL " command - this same!
Thanks, Andrew |
|
|
|
Re: new problem - SLX3.10
Posted: 26 Apr 09 4:34 AM
|
Use this instead:
strSQL = "select * from vendor where 1=0" h = DBOpenSQL (sql, false) DBInsert h DBSetValue "VendorID", vend_id DBSetValue "CreateDate", cstr(Now) .. .. DBPost h DBClose h
Essentially, don't use DBOpenTable, don't try and concatenate date/time - and always cstr() anything that isn't already a string. This stuff only applies to Legacy code of course. |
|
|
| |
|
Re: new problem - SLX3.10
Posted: 26 Apr 09 9:29 AM
|
I did try to recreate this table and during process of applying changes to database it stoped with popup message: "Invalid Password". It is starange because I don't remember having problems with passwords within this installation.
Any ideas/sugestions? Andrew |
|
|
|
Re: new problem - SLX3.10
Posted: 26 Apr 09 9:43 AM
|
It is still not working!
Other question: I'm using vend_ID = DBCreateIDFor("vendor") to to set id for records in this table. Now I have new vendor table but this function is generating id like for old table. Table is empty but it shows id=.......288
Thank you for any help. Andrew |
|
|
|
Re: new problem - SLX3.10
Posted: 27 Apr 09 3:19 PM
|
The IDs for Custom tables are generated out of the "Other" key: (SELECT * FROM SITEKEYS), thus you will not see the IDs on this table be in order, it will jump around as there are several tables that share this key.
|
|
|
|
Re: new problem - SLX3.10
Posted: 27 Apr 09 3:26 PM
|
Originally posted by Andrew
DBSetValue Handle, "vednorId", vend_ID
|
|
Did you type this code or pasted it? - The ID field seems to have a wrong spelling since the Table Name is Vendor.
- Also, seems as if the Concatenation for the Create Date and Modify Date could be causing problems as well (haven't tested it, but I see a potential there). I would recommend you just use the Now() function: DBSetValue Handle, "CreateDate", CStr(Now()) DBSetValue Handle, "ModifyDate", CStr(Now())
- Also, do you know if the code is executing? Any errors? Use LogixClearError and LogixErrorText to clear the Error before executing and checking the errors after you do the Post.
|
|
|
|
Re: new problem - SLX3.10
Posted: 27 Apr 09 10:01 PM
|
Originally posted by Raul A. Chavez
The IDs for Custom tables are generated out of the "Other" key: (SELECT * FROM SITEKEYS), thus you will not see the IDs on this table be in order, it will jump around as there are several tables that share this key.
|
|
So far I didn't spot any out of ordeer id, allways were in order and advanced by 1.
Andrew |
|
|
|
Re: new problem - SLX3.10
Posted: 27 Apr 09 10:09 PM
|
Originally posted by Raul A. Chavez
Did you type this code or pasted it? - The ID field seems to have a wrong spelling since the Table Name is Vendor.
- Also, seems as if the Concatenation for the Create Date and Modify Date could be causing problems as well (haven't tested it, but I see a potential there). I would recommend you just use the Now() function: DBSetValue Handle, "CreateDate", CStr(Now()) DBSetValue Handle, "ModifyDate", CStr(Now())
- Also, do you know if the code is executing? Any errors? Use LogixClearError and LogixErrorText to clear the Error before executing and checking the errors after you do the Post.
|
|
VENDORID - this is copied directly from Database Manager
CStr(Now()) - I already have fixed this.
do you know if the code is executing? - yest it is - I vave two msgboxes just before and after this code. Both msgboxes are poping up.
LogixClearError and LogixErrorText - I will try it tomorrow. |
|
|
|
Re: new problem - SLX3.10
Posted: 27 Apr 09 11:21 PM
|
Originally posted by Andrew
LogixClearError and LogixErrorText - I will try it tomorrow. |
|
These functions will help you get the error information from the DB Engine.
Originally posted by Andrew
So far I didn't spot any out of ordeer id, allways were in order and advanced by 1.
|
|
This is probably because you aren't creating records in several tables that require IDs from the Other category. If you have multiple Custom Tables that require Primary ID, and start generating IDs for each table you will see how each ID is sequential, even though you are calling it for different tables.
E.g. If you execute the following code: msgbox DBCreateIDFor("vendor") Result: Q6UJ9A000001 msgbox DBCreateIDFor("vendor_2") Result: Q6UJ9A000002 msgbox DBCreateIDFor("vendor_3") Result: Q6UJ9A000003 msgbox DBCreateIDFor("vendor_4") Result: Q6UJ9A000004 msgbox DBCreateIDFor("vendor") Result: Q6UJ9A000005
The reason for this is that each ID is generated sequentially from the Other category out of the Sitekeys table. A good reference article regarding IDs can be found on this site: http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=87
Now, one thing is for sure, you are really making us dig deep into our past to retreive some of this knowledge. Although I have to admit that I somewhat loved Cypress Enabled VB, dropping it was quite a blessing.
P.S. One last thing to be aware of with Cypress Enabled VB Script (Legacy Scripting): If you have a function that return a boolean, it then makes all the functions return true (or was it false?) This was a big bug, that even though I knew about, I found myself many times debugging (sometimes it was other dev's code that when integrated would cause this silent failure). So, for SLX 3.10, do not Implement functions returning booleans, rather return a string "True" or "False" and then compare the value accordingly as a string. |
|
|
|
Re: new problem - SLX3.10
Posted: 28 Apr 09 9:36 PM
|
!!! Thank you very much for your help !!!
I would like to let you know so my problem is solved!!! - it was vendorId misspeling!!! I never expected so it will just go on without crashing or any error reporting in such case!
Every such post, like yours, make me to know and understand SLX and programming better and better.
I know, it is old, but I have what I have and... I know few companies still runing on Novel 3.12 and computers without Hard Drives, booting from flopies. They bought them 15 years ago, last virus they had 10 years ago, server was working once non stop, almost 4 years without restarting. They are turning off copmuters just by switching them off, at any time, and next day, they can start from this same point, losing only last sentence. They are printing every business form, labels, barcodes on laser printers and all that on Novel3.12, DOS6.22 and FoxPro2.6. The only think they are missing is internet.
I'm positive, I'm not wasting my time by lerning all of that, I know some day I will use my kowledge one way or another.
So, thank you, all of you for this forum and for help you are providing. I hope some day I will be able to help too.
See you soon! Andrew |
|
|
|
Re: new problem - SLX3.10
Posted: 29 Apr 09 3:12 AM
|
He he - you should have seen my original post - I noticed you'd misspelled it and I'd corrected it for you ! |
|
|
|
Re: new problem - SLX3.10
Posted: 30 Apr 09 7:16 PM
|
Originally posted by Mike Spragg
He he - you should have seen my original post - I noticed you'd misspelled it and I'd corrected it for you ! |
|
Now I can see it!!!
Thanks, Andrew |
|
|
|
Re: new problem - SLX3.10
Posted: 30 Apr 09 9:35 PM
|
That is why I went as far as pointing it out specifically on one my responses, even quoting the original code with the misspelled field name.
Sometimes, all you need to do is take break, and then look at it from a different angle.... |
|
|
|
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!
|
|
|
|
|
|
|
|