Jump to content
UBot Underground

Numbers being forced as "text"


Recommended Posts

Hi everyone, long time no see! :)

 

My problem is that I'm getting "cannot add two strings together" even though I'm trying my best to make sure it's parsed as a math expression.  Pretty basic you would think!

#total_revenue: 0Cannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two stringsCannot multiply two strings19

I have a table, and I'm trying to remove duplicate rows.  What I'm doing is saving each row to a list and then allowing the list to remove duplicates:

set(#remove_dupes_counter, 0, "Global")
loop($table total rows(&comms_refined_one)) {
    set(#ref_one_holder, "{$table cell(&comms_refined_one, #remove_dupes_counter, 0)},{$table cell(&comms_refined_one, #remove_dupes_counter, 1)},{$table cell(&comms_refined_one, #remove_dupes_counter, 2)},{$table cell(&comms_refined_one, #remove_dupes_counter, 3)}", "Global")
    add item to list(%removedupes, #ref_one_holder, "Delete", "Global")
    increment(#remove_dupes_counter)
}

Then I save the list to a csv file, and I make a new new table from it (yes this is very hacky but I've had to try a lot of things to make this work!):

save to file("{$special folder("Application")}\\listcache.csv", %removedupes)
create table from file("{$special folder("Application")}\\listcache.csv", &comms_refined_two)

The CSV file looks correct when I open it outside ubot. To me it looks like I can create a new table from this file and columns 2 and 3 should be read as real numbers:

admin@email.com,email@yahoo.com,0009,9.5
support@email.com,Accounting@email.com,0001,7.6
support@email.com,email@gmail.com,0009,7.6

The error comes when I try to do this:

set(#total_revenue, $add(#total_revenue, $multiply(#makemath, 2)), "Global")

This is an extra step but I created a variable called #makemath to hold the last number in the new table I created above, but that didn't work either.:

set(#makemath, $table cell(&comms_refined_two, #refined_comms_count_2, 3), "Global")

Anyone got any ideas?

 

I need to either make the numbers = numbers and not strings, or think of a different way of removing duplicate rows from the table altogether.  Cheers!

Link to post
Share on other sites

I should also add I tried creating the first variable  like this too:

set(#ref_one_holder, $add($add($add($add($add($add($table cell(&comms_refined_one, #remove_dupes_counter, 0), ","), $table cell(&comms_refined_one, #remove_dupes_counter, 1)), ","), $table cell(&comms_refined_one, #remove_dupes_counter, 2)), ","), $table cell(&comms_refined_one, #remove_dupes_counter, 3)), "Global")

So I tried with the table cells outside "" and {}.

Link to post
Share on other sites
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...