| View previous topic :: View next topic |
| Author |
Message |
andybrock NeoBooker
Joined: 20 Apr 2009 Posts: 30
|
Posted: Fri Jun 12, 2009 6:28 am Post subject: Setting a field for a selection of records |
|
|
I have a database of products and there are a series of status flags which are boolean fields for if the product is discontinued, etc.
If I perform a query so that the current view is of a set of products that match a criteria is there an easy way to set the status flag to true for all currently queried records or do I have to loop through each one and change the flag?
Andy |
|
| Back to top |
|
 |
Wrangler NeoBooker

Joined: 31 Mar 2005 Posts: 1331 Location: USA
|
Posted: Fri Jun 12, 2009 7:19 am Post subject: |
|
|
First do your query, then do dbpstrReplace. Then showall to view all records again. _________________ Wrangler
--------------
Before you criticize someone, walk a mile in their shoes. Then when you criticize them you're a mile away and you have their shoes. - Wrangler
Software made with NeoBook
http://highdesertsoftware.com |
|
| Back to top |
|
 |
carlos torres NeoBooker
Joined: 02 May 2005 Posts: 223 Location: Pamplona, Colombia
|
Posted: Sat Jun 13, 2009 9:16 pm Post subject: about setting a field |
|
|
Dear Andybrock
I agree with Wrangler do the query first and after that you can exert an sql statement in order tu update an specific field.
| Code: | If "[AnyCondition]" "<>" ""
dbpExecSQL "DBAlias" "UPDATE MyTableName SET MyField =[#39][MyNewValue][#39] |WHERE FieldOne=[#34][Value][#34] AND Field2=[#34][OtherValue][#34] AND STATUS=TRUE" ""
EndIf
EndIf |
I hope it will help you
regards
carlost |
|
| Back to top |
|
 |
Wrangler NeoBooker

Joined: 31 Mar 2005 Posts: 1331 Location: USA
|
Posted: Sat Jun 13, 2009 9:22 pm Post subject: |
|
|
Carlos: One too many "endif"s. Or, not enought "if"s. However you look at it.  _________________ Wrangler
--------------
Before you criticize someone, walk a mile in their shoes. Then when you criticize them you're a mile away and you have their shoes. - Wrangler
Software made with NeoBook
http://highdesertsoftware.com |
|
| Back to top |
|
 |
andybrock NeoBooker
Joined: 20 Apr 2009 Posts: 30
|
Posted: Mon Jun 15, 2009 9:15 am Post subject: |
|
|
Thanks for your replies. I didn't realise you could search/replace a boolean field. Still used to far more restrictive programming languages.
Andy |
|
| Back to top |
|
 |
|