How do I Change Content in a table.

OSXFreak

New Member
[FONT=&quot]Ok this is an EASY one for you GURU's..

I have to change some data in a table called notes. The data is to change the [/FONT][FONT=&quot]1149945231 to 1087359774.

[/FONT][FONT=&quot]I'm not sure how to go about writing a Q&D to change just those variables,

So Here's what I wrote but it's a no-go...[/FONT]


[FONT=&quot][/FONT]

[FONT=&quot]for each notes where notes.cono = 50 and notes.notestype = "C" and notes.noteln
= "** GST#: 100756238 / QST# 1149945231 **" exclusive-lock:[/FONT]



[FONT=&quot]assign notes.noteln = "** GST#: 100756238 / QST# 1087359774**".[/FONT]

[FONT=&quot]End.

[/FONT][FONT=&quot]I think I need some kind of contain switch or something like that for the 1149945231, so it changes the right info.

I'm NEW to Progress programming, and just wondering if anyone has any idea what my best way to change this data is?

Also on a related note, are there good Online study guides to learn Progress from[/FONT][FONT=&quot]?

Thanks

Chip
[/FONT]
 
[FONT=&amp]
So Here's what I wrote but it's a no-go...[/FONT]

What is no-go about it? Are no records found? Or are records found but records not updated?

If no records are found, your where clause does not match as you think it does.

Depending on how structured this description is, you can use MATCHES, INDEX or LOOKUP (look the functions up in the help). The one most fitting for this job seems to be LOOKUP:

Code:
DEF VAR cold AS CHAR INIT "1149945231".
DEF VAR cnew AS CHAR INIT "1087359774".

DEFINE BUFFER bnotes FOR notes.

FOR EACH notes
   WHERE notes.cono = 50
   AND notes.notestype = "C"
   AND LOOKUP( notes.noteln, cold, " " ) > 0
NO-LOCK:

   FIND bnotes WHERE ROWID( bnotes ) = ROWID( notes ) EXCLUSIVE-LOCK.
   ENTRY( LOOKUP( bnotes.noteln, cold, " " ), bnotes.noteln, " " ) = cnew.

END.

The above assumes that the note is nicely formatted with spaces around the Queensland Service Tax (?) number.

Beware that any function in a where clause will result in all records that match the rest being read and evaluated.
 
Stefan,

Thank you SO MUCH for the information and the code. Sadly it had ha error.. When I ran it, this is the error I got:

** Only individual array elements allowed in expressions. (361)
** Could not understand line 6. (196)

I kind of understand what your code did, and it looks like it will do exactly what I needed, but, well, it had an error.. Any idea?

Looking at most of the QST, I believe they all have spaces around them. There may be one or two that do not, but my users chan manually change those and easy to identify with Hyperion report. :)

Thanks

Chip
edit: PROGRESS Procedure Editor Release 10.1B03 figured you might want this info :)
 
Stefan,
** Only individual array elements allowed in expressions. (361)
** Could not understand line 6. (196)

This means that one of the fields that you are addressing is an extent field (array). You can indicate which element of the array you want by adding square brackets with the element. The elements start at 1. If your field names are in any way sane, then my guess is that noteln is an extent field and will therefore need to indicate which element you want to check.

You can view the definitions of your fields (including extents) in the data dictionary.

If you want to check multiple elements with the array then you will need to add some more code.
 
[FONT=&amp]
Also on a related note, are there good Online study guides to learn Progress from[/FONT][FONT=&amp]?
[/FONT]

All the manuals are available online at psdn.com. There a lot of pages, start with the basics.
 
Actually now that you mention it, your right... Obviously.. :) The noteln is an array, so I'll need to put in the noteln[1] and so on.. Thanks for the info I'll give that edit a try.

Chip
 
Back
Top