I use
$table->update($data, $where);
How do I get updated row id in ZEND?
As with working with just the plain ol' SQL, just re-query for the info you want. Use $table->select('rowid')->where($where) to do this.
from manual :
The return value is the number of
rows affected by the update
operation.
its not what you want. so you need to using select to get the row
Related
Here is my entity definition
What I want to achieve is increment
status.sentCount
on every api call made.
I have gone through documentation and tried to implement the solution for embedded entity
Although it work for direct field like "age" but doesn't seem to be working for simple-json object "status".
Thank you. Any help is appreciated.
You're dealing with jsonb type data, which you cannot update directly. You can use jsonb_set function provided by Postgres.
set(`jsonb_set(status, '{sentCount}', 'new_value')`)
I didn't try it but I hope it will work for you.
You can find more info here https://aaronbos.dev/posts/update-json-postgresql
Edited:
Use following query
UPDATE your_table SET status = jsonb_set(status, '{sentCount}', (COALESCE(status->>'sentCount','0')::int + 1)::text::jsonb) WHERE id = 1;
How do I tell Filemaker what table to paste a value into based on the value? Is there a way to somehow have Filemaker paste a value into a table without hard coding the table name?
Using imported transaction data, I determine which ledger (table) the transaction should be posted to. But I can't seem to get the script to then post it into the right table based on the value.
Screenshot of Script
Thanks for the thoughtful suggestions!
I found a way to do what I was thinking, #AndreasT your suggestion helped.
Case (
Imported_Transactions::Debit_To = "Expenses_All"; "Expenses_All::Description";
Imported_Transactions::Debit_To = "Liability_CrCard_BofA"; Liability_CrCard_BofA::Description;
Imported_Transactions::Debit_To = "Liability_CrCard_CitiBusiness"; Liability_CrCard_CitiBusiness::Description;
)
Using the Case function, I was able to get Filemaker to put the data in the right table. It took some doing, but by putting the tablename::field in quotes, it worked.
Ultimately, though, I found it easier to just use one table and field descriptors to store my data. Simplicity makes it easier to produce reports.
You could use the conditional If script step to determine what table to insert data into based on your input.
Set field by name[ tablename::fieldname ; value ]
I want to show a variable value (record count of a table) on an Access form. I tried with a textbox by defining its control source with the following and many other internal functions but all returned only errors. Anyone can help? Thanks
select count(*) from TableName
I would also suggest the DCount domain aggregate function as suggested by Andre, but to offer an alternative, if TableName is the Record Source for your form, you can also use:
=Count(*)
To count all records in the Record Source, or:
=Count([FieldName])
To count all non-null values of a particular field in the Record Source.
You need = and domain functions.
=DCount("*", "TableName")
should work as control source.
I'm running a select count query in a tDB2Row component. I need to get the value found and insert it into another table.
I've tried using the propagate query's recordset, but it doesn't make sense to me.
Also what component would i use next?
Thanks in advance!
Please use tDB2Input component for select query and give schema to it and add tLogRow to it to see the result.
tDB2Row is for dml query like update and delete.
Hope this helps...
I am using TinyMCE to allow users to write in what will eventually be submitted to a database.
TinyMCE includes a button which will insert a "pagebreak" (actually just an HTML comment <!--pagebreak-->).
How can I later pull back everything up to the first occurrence of the pagebreak "tag"? There might be a significant bit of data after that tag which I could discard via php later, but it seems like I shouldn't even bring it back. So I can I SELECT just part of a column if I never know how far in to the data the <!--pagebreak--> will be?
EDIT:
The below answer does work, and will get me where I need to go.. I am just curious as to if there is an equally simple way to handle bringing back the whole column if it is short and thus the pagebreak tag doesn't exist. With the below solution, if no pagebreak is found, an empty string is returned.
If not, then I can easily handle it in the code.
Something like this should get you everything up to the <!--:
SELECT SUBSTRING(my_col FROM 1 FOR POSITION('<!--' IN my_col)-1) AS a_chunk
FROM my_table
Reference for string functions.
Edit:
Just putting OMG Ponies' words into SQL:
SELECT CASE WHEN position('<!--' IN my_col) > 0
THEN SUBSTRING(my_col FROM 1 FOR POSITION('<!--' IN my_col)-1)
ELSE my_col END AS a_chunk
FROM my_table
It sounds like you'll also want a check on the length of the text; whether or not there is a page break. You can use CHARACTER_LENGTH() for that.
why not create another column in your mysql table to store integer value of the position where <!--pagebreak--> is. You'll calculate this value in your script and store this value at same time when you insert the html generated by tinymce.
Then in later retrievals use the value in that column to select the substring from 1 up to the value. This should make your query simpler and maybe improve query performance?