Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6495 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I want create new records based on a flag in a seperate table using a script that IWP (Instant Web Publishing) compatible.

Normal if I did not need it to be IWP, I would find the flag, and import those records.

What is the best way to automate this process, so that it is IWP compatible?

Posted

IWP is pretty flexible in allowing you to run scripts and do a lot of things.

To bypass the Import function you can either make use of global fields and a relationship that links the 2 tables together so that data can be sent to the global fields in the destination table OR you can get more creative if you want to try your hand at data parsing and just send all the relevant data in a single data string via the script parameter to the destination table when you execute the create script there.

Here is an example using the global fields approach:

## sample fields in Table 1 (source table)

## ID, Name, Phone, MarkFlag

##

## sample fields in Table 2 (destination table)

## ID,Name,Phone,GlobalID,GlobalName,GlobalPhone

Table 1 (Script Name: Locate/Send Records)

Enter Find Mode

setfield [MarkFlag]["x"]

Perform Find

Go to Record/Request FIRST

Loop

Setfield[table2::globalID][iD]

Setfield[table2::GlobalName][Name]

Setfield[table2::GlobalPhone][Phone]

Perform Script[Table 2:Create Record]

Go to Record/Request NEXT ; EXIT AFTER LAST

End Loop

Table 2 (Script Name: Crete Record)

New Record/Request

Setfield [iD] [GlobalID]

Setfield [Name] [GlobalName]

Setfield [Phone] [GlobalPhone]

commit record/request NO DIALOG

Posted

Thanks,

I actually went with script parameter idea. Over all it seems smoother.

One last question. I have a global text field, and I use the first word for the new record, is there a way cut or delete the first word in a calculation?

Posted

it may not be the smoothest way, but I figured it out

I set up a second gbl_text field, that is:

set field(right words (gbl_text;wordcount(1stGbl_text) -1)

the:

Set (1st Gbl_text = the gbl_text)

Posted

To cut or delete a word in a field or variable use:

trim(Replace ( globalText ; 1 ; length( leftwords( globalText ;1) ) ; "" ))

This will remove the first word from your text field which in this example is called globalText.

If you just want to grab the first word just use:

leftwords(globaltext ; 1)

This topic is 6495 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.