February 8, 200719 yr 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?
February 9, 200719 yr 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
February 9, 200719 yr Author 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?
February 9, 200719 yr Author 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)
February 12, 200719 yr 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)
February 12, 200719 yr Yep it would. : I reread the post and realized that rightwords is a better way.
Create an account or sign in to comment