How count the inserted records?

in this image it show a message


and in this image it show all records in table

But when modifying the code to count the selected records, the message showed only one number.

Could you please help me count the selected records or those that have been inserted?
like this image:

Hi,
You Can COUNT the records Before your INSERT IGNORE… statement.
( [count_records] variable type OUT for later show your message)

[count_records] = “Count(*) from accommodate where accommodate_emp_id = '”.$to_copy"’";

1 Like

Thank you very much for your help I am grateful for this.
You are the best teacher in SC.
I try your pevious code but it get an error message.
So, I changed it to this


and this

But no result … no message display the number of selected records

Hi, your code must fix it.

ONSCRIPTINI
[count_records] = 0;

ONRECORD
Here, you must execute macro for your SQL: Like This:

$sql_count = “SELECT Count(*) from accommodate where accommodate_emp_id = '”.$to_copy"’";

sc_select(dataset, $sql_count );

if ( !(false == {dataset}) || !({dataset}->EOF) )
{
[count_records] = [count_records] + {dataset}->fields[0];
}

1 Like

I excuted that then it show error message like this:


so I modified it again, it show another error like this:

So. where I put code to show message to inform me the number of record selected

Thanks in advance

in your same event ONFINISH.

Verify your variable $to_copy. I dont know if this one is Good.

1 Like

Sincere thanks, appreciation and respect
I’ll try again

I try again


But the same error

your SQL in ONRECORD is bad formatted.
It must have word SELECT:

$sql_count = ‘SELECT Count(*) …’

1 Like

I modified it


But the same error

Thanks in advance

I think your error is the line:
$to_copy = implode …;

The global variable [selected] what values have?
you must set echoes for know its values.

add this lines AFTER $to_copy = implode …:

echo 'SELECTED: '.[selected];
echo 'T COPY: '.$to_copy;

1 Like

Thank you for your patience and trying to solve my issues.

1 Like