Missing value error

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
florencepugh
Posts: 1
Joined: Thu Jul 11, 2024 3:55 am
Contact:

Missing value error

Post by florencepugh » Thu Jul 11, 2024 3:57 am

I'm trying to calculate the total amount spent by a customer in my LiveCode database app. Here's the script I'm using:

Code: Select all

on calculateTotalSpent (customerName)
  local total := 0
  repeat with aRow in orders where customer = customerName
    put the amount of aRow into total
  end repeat
  return total
end calculateTotalSpent
When I run this script, I get an error message about "missing value." I think the problem is related to how I'm accessing the "amount" field in the orders table. Can someone help me fix this error?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Missing value error

Post by FourthWorld » Thu Jul 11, 2024 4:42 am

GPTs are notoriously bad at pretending to know how to write LiveCode.

What are you working on?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Missing value error

Post by stam » Thu Jul 11, 2024 7:54 am

Actually that code is bad even for chatGPT…

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10094
Joined: Fri Feb 19, 2010 10:17 am

Re: Missing value error

Post by richmond62 » Thu Jul 11, 2024 9:02 am

The OP is , supposedly, a first time poster.

I wonder how many first time posters jump in at the deep end to shark-infested waters?

Or, maybe, Bot-infested . . . LOL.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Missing value error

Post by FourthWorld » Thu Jul 11, 2024 10:00 am

stam wrote:
Thu Jul 11, 2024 7:54 am
Actually that code is bad even for chatGPT…
Well, at least regenerative software has completely transformed gymnastics:
https://youtu.be/YwJIYj3hPAU

😁
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10317
Joined: Wed May 06, 2009 2:28 pm

Re: Missing value error

Post by dunbarx » Thu Jul 11, 2024 2:41 pm

Florence.

So is it true? You tried to run a GPT script in the real world? :D

What experience do you have with LiveCode?

In any case, the task at hand is simple, just give us a short description. It will likely take about ten lines of code, and you must have your data already stored somewhere.

Craig

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Missing value error

Post by stam » Thu Jul 11, 2024 2:59 pm

I think it might be the other way round: ChatGPT tried to run Florence in the forum :P :P :P :P :P

stam
Posts: 3069
Joined: Sun Jun 04, 2006 9:39 pm

Re: Missing value error

Post by stam » Thu Jul 11, 2024 3:00 pm

FourthWorld wrote:
Thu Jul 11, 2024 10:00 am
Well, at least regenerative software has completely transformed gymnastics:
https://youtu.be/YwJIYj3hPAU
That's one scary video!!!!!!

Klaus
Posts: 14190
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Missing value error

Post by Klaus » Thu Jul 11, 2024 3:03 pm

Hi Florence,

welcome to the forum!

Yes, that script looks cool, but will do nothing but throwing errors! :D
If you are using an SQLite or MySQL database, then you should use SQL,
since that will save you a lot of scripting in LC.

The SQL command for this is:

Code: Select all

...
### Replace ??? with the name of the column holding the amount of money:
SELECT SUM(???) FROM 'orders' WHERE 'customer' = 'customerName'
...
That will give you the TOTAL of that columns for the selected customer.
Hope that helps!

Best

Klaus

P.S.
Personal note:
A little "Hello" or something would not have hurt for the very first posting!

SparkOut
Posts: 2944
Joined: Sun Sep 23, 2007 4:58 pm

Re: Missing value error

Post by SparkOut » Thu Jul 11, 2024 3:37 pm

stam wrote:
Thu Jul 11, 2024 2:59 pm
I think it might be the other way round: ChatGPT tried to run Florence in the forum :P :P :P :P :P
This is funny! But also very true
:D

Post Reply