How can i pass a filed value from a table and insert in other table as initial value for the second table

Let’s say i have two table:
Table 1 is general settings and table two is invoice.

Table 1 has , company name, adress, invoice number first start, other documents number that will be pass to application table.

Table 2 its invoice table but the invoice number will be taken from general settings table becasue the invoice table will not be the same as id_invoice_table.
I need to pass the invoice number from general settings table 1 to the invoice number in table 2.

i need to set the invoice number in general settings table becasue it must be a custom number. When i will start the application i need to start with the last invoice number that i used on paper untill now when i start with application.

If the you are passing the information from one app to the other just pass it as parameter else use a global variable

thank you for the answer, but pls tell me how to do it, show me a short example pls.

i need to pass the {numer_1} from table A to {number} table B as initial value then the {number} from table B to incereas by 1 at each record insert.

thank you

I need to know the workflow of your solution to understand your problem

Data doesn’t move from table to table, but from app to app

How many app you use and which table do they control

Ok. I have Two table Table one is generalsettings where i have the fields:ids, company_name, company_adress, invoice_initial_number and serial. And now i have the second table such as invoicetable, that have fields: ids, customer_name,
invoice_number, and i want the value for this field (invoice _number)to be taken initial from generalsettings table, because will be an autoincrement invoice number. i can just set as autoincrement number in this table but i need to be custom number when i first start to introduce first record in the invoicetable. Thats why i need a generalsettings table to put there custom value and then to can pass in the table i need all over my application. I have form_settings_table, one application then for invoice i have form_invoice_table.

Without the flow between your apps, I cannot help you much.

If what understand is right this should help you

sc_lookup(my_data, "select invoice_number from generalsettings where ids = {ids}");
if ({my_data} === false)
       echo "Access error. Message=". {my_data_error} ;
elseif (empty({my_data}))
       echo "Select command didn't return data";
      {invoice_number} = {my_data[0][0]};

To update the invoice_number

{invoice_number} += 1;
sc_exec_sql("update generalsettings set invoice_number = {invoice_number} where ids = {ids}");

i receive “Select command didn’t return data”

what my_data is , i should replace with what?

my_data is just a variable to receive the data from the data, you can give it any name you want

the select has to be adapted to your table, this is a example of what it should look like

I really don’t have enough information to help you more