Jump to content

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

Recommended Posts

Posted

Well Im stuck again , I updated to 12 from 11 (Which is Awsome by the way) but now when i use my Import script it pulls all my info in correctly except for my relational ID now . So it brings in all the info and then goes all the way back to the first record whcih there are thousands and begins to over write the Relationl id of all my other records. Any idea why? See below....

Allow User Abort [ Off ]

Set Error Capture [ On ]

Set Variable [ $id; Value:PM::ID_PM ]

Go to Layout [ Equipment_Database” (Equipment) ]

Import Records

[ "Equipment upload sheet.xlsx"; Worksheet: "Sheet1" ; Target: “Equipment_Database||id_project|” ; Method: Add;

Character Set:

“Windows ANSI” ; Field Mapping: Source field 1 import to Equipment_Database||id_project|::Tag Number

Source field 2 import to Equipment_Database||id_project|::Manufacture

Source field 3 import to Equipment_Database||id_project|::Model Number

Source field 4 import to Equipment_Database||id_project|::Serial Number

Source field 5 import to Equipment_Database||id_project|::Location

Source field 6 import to Equipment_Database||id_project|::Filter Size

Source field 7 import to Equipment_Database||id_project|::Filter Type

Source field 8 import to Equipment_Database||id_project|::Filter Qty

Source field 9 import to Equipment_Database||id_project|::Belt size

Source field 10 import to Equipment_Database||id_project|::Belt Qty ]

[ No dialog; Data contains column names ]

If [ Get ( LastError ) ]

Show Custom Dialog

[ Title: "Import Issue"; Message: "No Records found or Imported"; Default Button: “OK, Commit: Yes” ]

Go to Layout

[ original layout ]

Adjust Window

[ Maximize ]

Exit Script

[ ]

End If

Loop

Set Field

[ Equipment_Database::_id_project ; $id ]

Go to Record/Request/Page

[ Next; Exit after last ]

End Loop

Go to Layout

[ original layout ]

I Think the problem is That i go to the original layout after the import and the set the ID field but id like a second or third or tenth opionion

Posted

You never to to the first record.

Before your Loop statement you need a go to record [ First ] statement.

  • Like 2
Posted

So i need to move my Current Go to Record to before the loop like this?

Allow User Abort [ Off ]

Set Error Capture [ On ]

Set Variable [ $id; Value:PM::ID_PM ]

Go to Layout [ Equipment_Database” (Equipment) ]

Import Records

[ "Equipment upload sheet.xlsx"; Worksheet: "Sheet1" ; Target: “Equipment_Database||id_project|” ; Method: Add;

Character Set:

“Windows ANSI” ; Field Mapping: Source field 1 import to Equipment_Database||id_project|::Tag Number

Source field 2 import to Equipment_Database||id_project|::Manufacture

Source field 3 import to Equipment_Database||id_project|::Model Number

Source field 4 import to Equipment_Database||id_project|::Serial Number

Source field 5 import to Equipment_Database||id_project|::Location

Source field 6 import to Equipment_Database||id_project|::Filter Size

Source field 7 import to Equipment_Database||id_project|::Filter Type

Source field 8 import to Equipment_Database||id_project|::Filter Qty

Source field 9 import to Equipment_Database||id_project|::Belt size

Source field 10 import to Equipment_Database||id_project|::Belt Qty ]

[ No dialog; Data contains column names ]

If [ Get ( LastError ) ]

Show Custom Dialog

[ Title: "Import Issue"; Message: "No Records found or Imported"; Default Button: “OK, Commit: Yes” ]

Go to Layout

[ original layout ]

Adjust Window

[ Maximize ]

Exit Script

[ ]

End If

Go to Record/Request/Page

[ Next; Exit after last ]

Loop

Set Field

[ Equipment_Database::_id_project ; $id ]

End Loop

Go to Layout

[ original layout ]

Is this what you mean?

Posted

well that didnt work either and i even tried

Go to Record/Request/Page

[ First]

Loop

Set Field

[ Equipment_Database::_id_project ; $id ]

Go to Record/Request/Page

[ Next; Exit after last ]

End Loop

Go to Layout

[ original layout ]

It Still starts to Over write all the files

Posted (edited)

You never to to the first record.

Before your Loop statement you need a go to record [ First ] statement.

It is an 'Add' only import. There is no need to go to the first record; same with performing a find - you end up on the first record. You know this of course, Bruce, but I wanted to be sure it was clear so the hunt could go elsewhere. ;-)

Target: “Equipment_Database||id_project|”

Has Windows changed in version 7 that you can have a pipe character in the file name? Or am I misreading it? It might be best to attach your file (or send it to one of us back channel if you wish). Your original script is fine and it isn't because of your Go To Layout [ original ] within your If[] because you exit the script. :^)

Never mind ... I would bet that you have those pipes in the table occurrence name instead of the file name. But something is amiss for sure since you do not end up with a found set but all records ... it is failing for some reason!

Edited by LaRetta
Posted

You have debugger ... do you end up with a found set of only those imported records? You should have a found set before it begins the loop and it wouldn't be touching other records unless there is self-join or Cartesian. We need to see the file, I think.

Posted

Oops ... Your original script wasn't fine. And none of us saw it. You corrected it later anyway. It should be roughly...

Import

..error test and if fine

... Skip going to first record because you will be on it with new 'found set' after import

Loop

Set field ...

Go To Record [ NEXT ; exit after last ]

End Loop

The worst that would have happened with your original script was missing setting the first record in the set and perpetually looping the second record - not over-writing records outside of the imported set. Are these your exact scripts?

Posted

Oh Great LaRetta Wise and all knowing , Found me again huh , Ya i dont know what happened when I upgraded . But When i use the debugger and step through the script , it all works absolutly perfect until the loop statement, It dosent even select the new imported records it just Automatically goes back to the very first record in the data base, if i did not need the $ID_Project so bad as it relates some of my tables it would be a great script. But i need the ID so right, now when i do an import i watch my table view and when the imports done i halt the script and then manually place the ID into all the Imported record but some times that can be hundreds, Below is the exact script;

Allow User Abort [ Off ]

Set Error Capture [ On ]

Set Variable [ $id; Value:PM::ID_PM]

Go to Layout [“Equipment_Database” (Equipment)]

Import Records [No Dialog; Source: "Equipment upload sheet.xlsx"; Worksheet: "Sheet1" ;Add; Windows ANSI]

If [ Get ( LastError ) ]

Show Custom Dialog ["Import Issue"; "No Records found or Imported"]

Go to Layout [ original layout ]

Adjust Window[ Maximize ]

Exit Script [ ]

End If

Loop

Set Field [Equipment_Database::_id_project ; $id]

Go to Record/Request/Page

[ Next; Exit after last ]

End Loop

Go to Layout [ original layout ]

Adjust Window

[ Resize to Fit ]

What do your Wise and Knowing eyes see that i cant??

Posted

... it all works absolutly perfect until the loop statement, It dosent even select the new imported records it just Automatically goes back to the very first record in the data base

I see nothing wrong in your script. What do you mean that it just 'goes back to the very first record in the database?'. This isn't making sense. Does it loop at all?

There must be a trigger on layout . Did you check for triggers? It first produces a found set and THEN switches to all records? Provide the file please or we could waste time guessing further which will waste your time and ours. :-)

Posted

I cant provide the file unfortunatly as it is over 300 mb , But i dont belive there is any triggers , i would see them in the script debugger............Right? I gonna Double Check

This topic is 4569 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.