Subscribe to this thread
Home - General / All posts - Help writing a script fo Manifold 8. Select and write in table
samuelgj26 post(s)
#05-Nov-21 17:31

Hello! I need some help I am not a programmer

I need to write a simple script to find, select and write in a table on Manifold 8.0

This is an example of what I am looking for:

Choose table “Table name”

find in column "column name A" records containing any of these texts "various text, a, b, c, d, ..." and select these records.

Write in selection in column "column name B" "Text to write"

Write in selection in column "column name C" "Text to write"

artlembo


3,222 post(s)
online
#05-Nov-21 18:46

This should be an easy SQL update query. Can you attach a small .map file as an example. Then, one of us can write the SQL.

samuelgj26 post(s)
#05-Nov-21 19:00

Thank you very much!

These .map file contains a example of the case

These is more precise

Choose table “Denue_inegi_08_POI2021 REST”

find in column "nom_estab" records containing any of these texts "pizza, italian, pasta, domino, italy, ..." and select these records.

Write in selection in column "POI_TYPE2" "Pizzas e italiana" and

Write in selection in column "POI_TYPE3" "Other pizza and italian"

Attachments:
08 Chihuahua.map

Sloots

549 post(s)
#05-Nov-21 19:03

--sql

update

[table name]

set

[column name B] = "Text to write"

, [column name C] = "Text to write"

where

[column name A] like "%a%"

or

[column name A] like "%b%"

-- Something like this.

-- Not tested

Chris


http://www.mppng.nl/manifold/pointlabeler

samuelgj26 post(s)
#05-Nov-21 19:54

Thankyou but almost!

How can I define less exactly what to find example with contains, this script return error

update

[Denue_inegi_08_POI2021 REST]

set

[POI_TYPE2] = "Pizzas e italiana"

, [POI_TYPE3] = "Pizza Hut"

where

[nom_estab] contains "PIZZA HUT"

or

[nom_estab] contains "PIZA HUT"

samuelgj26 post(s)
#05-Nov-21 20:38

Thankyou, this is the solution, I didnt write % in the text to find

samuelgj26 post(s)
#06-Nov-21 02:36

Chris

Can you helpme again please? how can I add a new query after this one?

Thank you very much!

update

[Denue_inegi_08_POI2021 REST]

set

[POI_TYPE3] = "Buffalo Wild Wings"

where

[POI_TYPE2] like "Alitas" AND

[nom_estab] like "%FALO WILD%"

set

[POI_TYPE3] = "Buffalocas"

where

[POI_TYPE2] like "Alitas" AND

[nom_estab] like "%BUFFALUCAS%"

Sloots

549 post(s)
#06-Nov-21 08:25

You can have only one WHERE clause. Create 2 queries, or shift to M9 where you can execute multiple worries from the same file.

Last but most important advice.... Read the manual and a book about SQL


http://www.mppng.nl/manifold/pointlabeler

samuelgj26 post(s)
#06-Nov-21 14:53

Thanks bro!

Sloots

549 post(s)
#06-Nov-21 15:19

Worries = queries


http://www.mppng.nl/manifold/pointlabeler

tjhb

9,886 post(s)
#06-Nov-21 17:49

If you are prepared to handle every case, then you can use SET with a CASE expression.

E.g.

UPDATE [table]

SET [POI_TYPE3] =

CASE

  WHEN [POI_TYPE2] = "Alitas"

  AND [nom_estab] LIKE "%BUFFALUCAS%"

    THEN "Buffalocas"

  WHEN [POI_TYPE2] = "Alitas"

  AND [nom_estab] LIKE "%FALO WILD%"

    THEN "Buffalo Wild Wings"

  -- ...

  ELSE

    "(unknown)"

END;

But as Chris says, there's no substitute for learning SQL (bit by bit). It's an investment, but will give you infinite flexibility.

samuelgj26 post(s)
#24-Nov-21 22:26

Thankyou very much!

These solve my problem perfectly

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.