Choising an I/O module
Hello,
I was wondering how can we choose an I/O module? my module needs to cover an input which varies from 0 to 25 V and with this module, we can choose a square signal, continue or triangle. Which module matches my characteristics? i've read the datasheet and i came across NI 9221. Can i use this module?
What do TTL,Sink/source mean? when the datasheet indicates that the signal level is 60VDC, does it mean it cover from 0 to 60?
Thank you.
Dhirah
Hi!
Your task seems not really clear
If you need 24 Volt input/ output, NI 9422 and NI 9474 are good.
NI 9422:
Number of channels..........................8
Input type..........................................Sinking/sourcing
Digital logic levels
OFF state
Input voltage ........................≤ 5 V
Input current.........................≤ 0.17 mA
ON state
Input voltage ........................ 11 to 60 V
Input current.........................≥ 1.2 mA
Ni 9422 is a DIGITAL input module. I cannot find max sampling frequency achievable, I only read 250 us max delay in input.
NI 9474 is a digital output module, with 8 channels, sourcing. i.e. when you turn on the single channel, you provide + 24 Volt to the load. You have to carefully read the manual to check if it fulfills your load's specifications!
If you need Relay out,NI 9481 has 4 relays (4 output channels), SPST. I've found no more relay modules, this is a problem if you need more sofisticated relays (SPDT, etc....), you'll have to turn to another system, or you integrate some other electronics.
graziano
PS.: this was the my last answer for free to have better details you can phone NI, they're really kind both in commercial and support!
Message Edited by Graziano on 04-17-2008 09:15 AM
Similar Messages
-
Problème configuration NI 9870 pour comunication RS232
Bonjour,
je dois pour un projet récupérer les données provenant d'un capteur de pression via un cable RS 232. Etant donné que dans le futur je vais avoir besoin de mesurer les donnés d'un autre appareil via RS232, j'ai choisi d utiliser le module NI 9870 (cRIO 9074).
Les donnés provenant de l'appareil sont les suivantes : 1 bit de début, 7 bits de données + 1 espace, 1 bit de fin. Je dois désormais configurer le NI 9870. Mais je ne sais pas exactement quoi indiquer dans les diverses rubriques : bit de parité ? (0 ? espace ?) ? bits de données ( 7 ? 8?).
J'ai deja testé plusieurs solutions avec le 9870 Interface DMA (exemle Labview) mais lors de la lecture j'obtiens toujours une erreur (65573,65775,65570).
Si quelqu'un pouvait donc m'aider, je lui en serai très reconnaissant.
D'avance merci
Thibaut DelepierreBonjour thibaut_del,
Merci d'avoir posté sur le forum National Instruments.
L'erreur que vous obtenez signifie qu'il y a un problème de trame quand les données ont été lues. Quelle vitesse de transfert (baud) utilisez vous? Quel est ce capteur de pression?
Romain P.
National Instruments France
#adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
>> NIDays 2011, le mardi 8 février au CNIT de Paris La Défense -
How to Use F4 help in Module Pool Programming??????
Hi Friends,
This is Jagadeesh, I have an issue Module Pool Programming. Any of you can go through on this and can give an required answer.
Issue is as follows,
I have an Input/Output field for that i need to give f4 help, based on that field the related data should sit in to my table control. The thing is there is no relation between the input/output field and the table control fields.
Is this possible? If so how can i do this.Hi Jagadeesh,
For F4 Values on Screen:
PROCESS ON VALUE_REQUEST
using module call starting with FIELD i.e FIELD field MODULE module
There are number of function modules that can be used for the purpose, but these
can fullfill the task easily or combination of them.
DYNP_VALUE_READ
F4IF_FIELD_VALUE_REQUEST
F4IF_INT_TABLE_VALUE_REQUEST
POPUP_WITH_TABLE_DISPLAY
DYNP_VALUE_READ
This function module is used to read values in the screen fields. Use of this
FM causes forced transfer of data from screen fields to ABAP fields.
There are 3 exporting parameters
DYNAME = program name = SY-CPROG
DYNUMB = Screen number = SY-DYNNR
TRANSLATE_TO_UPPER = 'X'
and one importing TABLE parameter
DYNPFIELDS = Table of TYPE DYNPREAD
The DYNPFIELDS parameter is used to pass internal table of type DYNPREAD
to this FM and the values read from the screen will be stored in this table.This
table consists of two fields:
FIELDNAME : Used to pass the name of screen field for which the value is to
be read.
FIELDVALUE : Used to read the value of the field in the screen.
e.g.
DATA: SCREEN_VALUES TYPE TABLE OF DYNPREAD ,
SCREEN_VALUE LIKE LINE OF SCREEN_VALUES.
SCREEN_VALUE-FIELDNAME = 'KUNNR' . * Field to be read
APPEND SCREEN_VALUE TO SCREEN_VALUES. * Fill the table
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TRANSLATE_TO_UPPER = 'X'
TABLES
DYNPFIELDS = SCREEN_VALUES.
READ TABLE SCREEN_VALUES INDEX 1 INTO SCREEN_VALUE.Now the screen value for field KUNNR is in the SCREEN_VALUE-FIELDVALUE and can be used for further processing like using it to fill the internal table to be used as parameter in F4IF_INT_TABLE_VALUE_REQUEST ETC.
F4IF_FIELD_VALUE_REQUEST
This FM is used to display value help or input from ABAP dictionary.We have to pass the name of the structure or table(TABNAME) along with the field name(FIELDNAME) . The selection can be returned to the specified screen field if three
parameters DYNPNR,DYNPPROG,DYNPROFIELD are also specified or to a table if RETRN_TAB is specified.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
TABNAME = table/structure
FIELDNAME = 'field name'
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNR
DYNPROFIELD = 'screen field'
IMPORTING
RETURN_TAB = table of type DYNPREAD
F4IF_INT_TABLE_VALUE_REQUEST
This FM is used to dsiplay values stored in an internal table as input
help.This FM is used to program our own custom help if no such input help
exists in ABAP dictionary for a particular field. The parameter VALUE_TAB is used to pass the internal table containing input values.The parameter RETFIELD
is used to specify the internal table field whose value will be returned to the screen field or RETURN_TAB.
If DYNPNR,DYNPPROG and DYNPROFIELD are specified than the user selection is passed to the screen field specified in the DYNPROFIELD. If RETURN_TAB is specified the selectionis returned in a table.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = field from int table whose value will be returned
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'screen field'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = internal table whose values will be shown.
RETURN_TAB = internal table of type DDSHRETVAL
EXCEPTIONS
parameter_error = 1
no_values_found = 2
others = 3.
POPUP_WITH_TABLE_DISPLAY
This FM is used to display the contents of an internal table in a popup window.The user can select a row and the index of that is returned in the CHOISE
parameter.The VALUETAB is used to pass the internal table.
A suitable title can be set using TITLETEXT parameter. The starting and end position of the popup can be specified by the parameters STARTPOS_COL / ROW and ENDPOS_ROW / COL .
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL =
ENDPOS_ROW =
STARTPOS_COL =
STARTPOS_ROW =
TITLETEXT = 'title text'
IMPORTING
CHOISE =
TABLES
VALUETAB =
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
e.g.
DATA: w_choice TYPE SY-TABIX.
DATA: BEGIN OF i_values OCCURS 0 WITH HEADER LINE,
values TYPE I,
END OF i_values.
PARAMETRS : id TYPE I.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR id
i_values-values = '0001'.
APPEND i_values.
i_values-values = '0002'.
APPEND i_values.
i_values-values = '0003'.
APPEND i_values.
i_values-values = '0004'.
APPEND i_values.
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL = 40
ENDPOS_ROW = 12
STARTPOS_COL = 20
STARTPOS_ROW = 5
TITLETEXT = 'Select an ID'
IMPORTING
CHOISE = w_choice
TABLES
VALUETAB = i_values
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
CHECK w_choice > 0.
READ TABLE i_values INDEX w_choice....now we can process the selection as it is contained
...in the structure i_values.
Other FM that may be used to provide input help is HELP_START .
regards,
Dj
reward for all useful answers. -
I want an example for event Process on Value-request in Module Pool
Hi,
I need to populate f4 values for a field in module pool program under POV event.
Can anyone send me the sample code.
Helpful answers will be rewarded .
Thanks and Regards
AdityaHi
For F4 Values on Screen:
PROCESS ON VALUE_REQUEST
using module call starting with FIELD i.e FIELD field MODULE module
There are number of function modules that can be used for the purpose, but these
can fullfill the task easily or combination of them.
DYNP_VALUE_READ
F4IF_FIELD_VALUE_REQUEST
F4IF_INT_TABLE_VALUE_REQUEST
POPUP_WITH_TABLE_DISPLAY
DYNP_VALUE_READ
This function module is used to read values in the screen fields. Use of this
FM causes forced transfer of data from screen fields to ABAP fields.
There are 3 exporting parameters
DYNAME = program name = SY-CPROG
DYNUMB = Screen number = SY-DYNNR
TRANSLATE_TO_UPPER = 'X'
and one importing TABLE parameter
DYNPFIELDS = Table of TYPE DYNPREAD
The DYNPFIELDS parameter is used to pass internal table of type DYNPREAD
to this FM and the values read from the screen will be stored in this table.This
table consists of two fields:
FIELDNAME : Used to pass the name of screen field for which the value is to
be read.
FIELDVALUE : Used to read the value of the field in the screen.
e.g.
DATA: SCREEN_VALUES TYPE TABLE OF DYNPREAD ,
SCREEN_VALUE LIKE LINE OF SCREEN_VALUES.
SCREEN_VALUE-FIELDNAME = 'KUNNR' . * Field to be read
APPEND SCREEN_VALUE TO SCREEN_VALUES. * Fill the table
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
TRANSLATE_TO_UPPER = 'X'
TABLES
DYNPFIELDS = SCREEN_VALUES.
READ TABLE SCREEN_VALUES INDEX 1 INTO SCREEN_VALUE.Now the screen value for field KUNNR is in the SCREEN_VALUE-FIELDVALUE and can be used for further processing like using it to fill the internal table to be used as parameter in F4IF_INT_TABLE_VALUE_REQUEST ETC.
F4IF_FIELD_VALUE_REQUEST
This FM is used to display value help or input from ABAP dictionary.We have to pass the name of the structure or table(TABNAME) along with the field name(FIELDNAME) . The selection can be returned to the specified screen field if three
parameters DYNPNR,DYNPPROG,DYNPROFIELD are also specified or to a table if RETRN_TAB is specified.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
TABNAME = table/structure
FIELDNAME = 'field name'
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNR
DYNPROFIELD = 'screen field'
IMPORTING
RETURN_TAB = table of type DYNPREAD
F4IF_INT_TABLE_VALUE_REQUEST
This FM is used to dsiplay values stored in an internal table as input
help.This FM is used to program our own custom help if no such input help
exists in ABAP dictionary for a particular field. The parameter VALUE_TAB is used to pass the internal table containing input values.The parameter RETFIELD
is used to specify the internal table field whose value will be returned to the screen field or RETURN_TAB.
If DYNPNR,DYNPPROG and DYNPROFIELD are specified than the user selection is passed to the screen field specified in the DYNPROFIELD. If RETURN_TAB is specified the selectionis returned in a table.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = field from int table whose value will be returned
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'screen field'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = internal table whose values will be shown.
RETURN_TAB = internal table of type DDSHRETVAL
EXCEPTIONS
parameter_error = 1
no_values_found = 2
others = 3.
POPUP_WITH_TABLE_DISPLAY
This FM is used to display the contents of an internal table in a popup window.The user can select a row and the index of that is returned in the CHOISE
parameter.The VALUETAB is used to pass the internal table.
A suitable title can be set using TITLETEXT parameter. The starting and end position of the popup can be specified by the parameters STARTPOS_COL / ROW and ENDPOS_ROW / COL .
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL =
ENDPOS_ROW =
STARTPOS_COL =
STARTPOS_ROW =
TITLETEXT = 'title text'
IMPORTING
CHOISE =
TABLES
VALUETAB =
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
e.g.
DATA: w_choice TYPE SY-TABIX.
DATA: BEGIN OF i_values OCCURS 0 WITH HEADER LINE,
values TYPE I,
END OF i_values.
PARAMETRS : id TYPE I.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR id
i_values-values = '0001'.
APPEND i_values.
i_values-values = '0002'.
APPEND i_values.
i_values-values = '0003'.
APPEND i_values.
i_values-values = '0004'.
APPEND i_values.
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL = 40
ENDPOS_ROW = 12
STARTPOS_COL = 20
STARTPOS_ROW = 5
TITLETEXT = 'Select an ID'
IMPORTING
CHOISE = w_choice
TABLES
VALUETAB = i_values
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
CHECK w_choice > 0.
READ TABLE i_values INDEX w_choice....now we can process the selection as it is contained
...in the structure i_values.
Other FM that may be used to provide input help is HELP_START .
Reward points if useful
Regards
Anji -
Search help in output(using alvgrid function module)
HEllo Experts,
I hav developed report using ALV grid function module, now my req is I need to provide the search help for particular field in the output.
my output contains .MATNO, PLANT AND STORAGE LOCATION.
Now based on mat and plant I need to provide the F4 help for storage location field in the out put.
could u pls anbody help me on the req asap. with details code.
will give u Full point if it suits my req....Hi Raja,
This is what you can try to do....first select the sales org and distribution channel for the value entered in the material in an 2 separate internal tables.
Then use the FM 'F4IF_INT_TABLE_VALUE_REQUEST' for each internal table to get a search help for the sales org and distribution channel for any particular material number.
Please write the code at AT SELECTION-SCREEN ON VALUE-REQUEST event.
or,
try this code.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_salesorg.
select salesorg from tablename into itab where matnr = p_matnr(selction screen value).
if sy-subrc eq 0.
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL =
ENDPOS_ROW =
STARTPOS_COL =
STARTPOS_ROW =
TITLETEXT =
TITLETEXT =
IMPORTING
CHOISE = W_LINEN0
TABLES
VALUETAB = itab
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
IF SY-SUBRC EQ 0.
READ TABLE itab INDEX W_LINENO.
IF SY-SUBRC EQ 0.
P_salesorg = itab-salesorg.
endif.
endif.
similarly for distribution channel pass sales org ....
kindly reward if found helpful.
cheers,
Hema. -
Function module or search help !
Hi ABAP gurus,
I have a requirement where I have to have the Material, Sales Organization and Distribution channel displayed as parameters on one screen.
But the trick here is when ever I select any material .. The sales organization and distribution channel should only have values that only correspond to that material only.
Basically the Sales organization and Distribution channel should only have values corresponding to that material only in F4 help.. How to achieve this ..There should be some function module for this can anyone help me with this requirement .
Correct answer would be rewarded accordingly !
Regards,
RagzHi Raghvendra,
try this.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_salesorg.
select salesorg from tablename into itab where matnr = p_matnr(selction screen value).
if sy-subrc eq 0.
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL =
ENDPOS_ROW =
STARTPOS_COL =
STARTPOS_ROW =
TITLETEXT =
TITLETEXT =
IMPORTING
CHOISE = W_LINEN0
TABLES
VALUETAB = itab
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
IF SY-SUBRC EQ 0.
READ TABLE itab INDEX W_LINENO.
IF SY-SUBRC EQ 0.
P_salesorg = itab-salesorg.
endif.
endif.
similarly for distribution channel pass sales org .... -
[TestStand][LabVIEW]faire module labview pour teststand
Bonjour,
Je suis a la recherche de tutoriel pour faire des modules LabVIEW pour TestStand.
J'ai trouvé les fonctions TestStand dans LabVIEW "Get Property Value" and co. mais je n'arrive pas à les mettre en oeuvre.
Merci
Résolu !
Accéder à la solution.Bonjour,
Je cherche à envoyé des requêtes en TCP/IP sur un module 'maison', et récupérer les éventuels réponse. (LabVIEW)
Faire cette procédure en boucle jusqu'a ce que je reçoive une réponse comportant une anomalie, l'arrêter (par ex) et l'inscrire dans un rapport. (TestStand)
J'ai déjà fait le Module LabVIEW, j'aimerai intégrer ce module dans une séquence TestStand pour automatisé l'envoie et la prise de décision en fonction de la réponse reçu.
Donc au final pouvoir choisir ce que j'envoie avec TestStand:
[TestStand: requêtes -> [LabVIEW] -> réponses ]
Assez compréhensible ?
Cordialement,
Anthelme
P.S.: Je dois avoué ne pas avoir compris vos solutions proposé... -
Synchroniser les horloges d'acquisition sur des modules c-DAQ analogiques
Bonjour,
J'ai deux modules d'aquisition compact daq : NI9205 (acquisition en tension, horloge d'échantillonnage à 250 KS/s) et NI9227 (acquisition en courant, horloge d'échantillonnage à 50 KS/s).
J'ai essayé de les mettre dans une seule tâche virtuelle, mais le problème c'est que si j'utilise l'horloge embarquée, j'ai une incompatibilité à cause des horloges différentes entre module.
J'ai donc essayé de passer via un compteur comme dans l'exemple ci-aprés mais pareil. Comment faut-il faire ?
Merci par avance pour vos réponses,
Christophe
Pièces jointes :
Essai acquisition continu courant.vi 44 KBBonjour.
Vous n'avez pas besoin de créer une source de cadencement pour votre boucle de lecture.Il suffit simplement de lire vos données avec DAQmx Lire dans une boucle classique. A partir du moment où la fréquence d'acquisition que vous choisissez est dans les spécifications des 2 modules, vous ne devez pas avoir de problème. La fréquence de lecture dépendra du nombre de points que vous avez choisi de lire à chaque tour de boucle dans le VI Daqmx Lire et la boucle se cadencera d'elle même.
Cordialement. -
Adobe Premiere Pro CS6: aucun module de lecture compatible
J'ai télécharger Adobe Premiere Pro SC6 et quand je le lance se message s'affiche " Adobe Premiere Pro n'a pu trouver aucun module de lecture vidéo compatible " Que dois ton faire ?
Merci, merci beaucoup , Je viens de faire la nouvelle configuration proposée et cela semble marcher, je n'ai pas encore trouvé de bugs avec d'autres programmes et adobe première semble fonctionner normalement ainsi que after effects. Je remercie encore vivement Sournoi de m'avoir transmis la solution Bien cordialement JP
Date: Mon, 13 Aug 2012 10:38:31 -0600
From: [email protected]
To: [email protected]
Subject: Adobe Premiere Pro CS6
Re: Adobe Premiere Pro CS6
created by Sournoi in Forums en français - View the full discussion
Si le probleme persiste :au démarrage aller dans le bios (F10 au lancement de la machine).puis aller dans onglet : Config systemechoisir le mode fixe pour la carte graphic au lieu du mode dynamique.poursuivre le démarrage de la machine. sous windows clic droit dans le bureauchoisir configurer les graphiques commutables ( si ça n'apparait pas ben ***** alors)et ensuite choisir le mode performance qui rebalance tout le fonctionnement graphique sur la carte radeon. en esperant avoir été assez clair et que ça marche good luck jack
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4617609#4617609
To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4617609#4617609. In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in Forums en français by email or at Adobe Forums
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746. -
Mixing memory modules on Westmere
Dear Hardware gurus,
I have a 12-Cores Westmere. Do you know is it possible to mix different memory modules on it, namely:
6x1 Gb 1330Mhz
+
2x4 Gb 1066Mhz
and if yes, in which configuration?
Thanks a lot for any comment!Kappy, thanks for the note.
I am actually going to order some more 1333 modules, but just for the short time I have to work with what I have currently (see my original post).
As I posted above, I tried a bit already to combine the modules and Mac doesn't boot
Can you suggest a configuration, which will work? -
in the export module for facebook every time i click "sign in to facebook" it gives the following error: "An error occurred while request facebook connection"
"An error occurred while request facebook connection"
The export module has been discontinued in Bridge CC and as long as it has been there the option for social media has worked only for FB in a few countries. Due to rights management (as we where told) there where restrictions for most other countries. But if it did work for you in the past you should try click on FB in export module or use the tiny menu icon in the export panel for preferences and try to set up a new connection. -
FileName in Sender File Adapter Module
Hi Folks,
In my sender file adapter have written a module to read the picked file name. The protocol used is NFS.
Notice that the file name read in the module has the absolute path, including the directory path. E.g The file name xyz has to be picked from source directory
XIServer\Outbound. In the module when I retrieve the file name, it comes up as
XIServer\Outbound\xyz. Is this expected behaviour?
I was expecting just the file name<xyz> to be retrieved.
Thanks,
AnandHI,
Create an UDF and write this code.
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key =
DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String ourSourceFileName = conf.get(key);
return ourSourceFileName;
in Adapter u will have Adapter specific parameters check the file name check box.
Using this UDF u will get the file name at target side.
Regards,
Phani. -
How do I use the Web module to upload video to my website?
I'm using the Lightroom HTML gallery to upload my photos, fine and dandy, very happy with it. I also have some videos trimmed in Lightroom that I want incorporated into the gallery. This doesn't seem to be happening, instead I just get thumbnails. What/how do I incorporate my video clips into my web gallery? I moved over from jAlbum so I could have a simple one-tool workflow, so I'm really hoping that this is possible.
You can combine stills and video for output to h.264 (mp4 file) for example to upload to Youtube or Vimeo.
FTP upload will be subject to the limitations of your host. The web module within Lightroom creates all resources to link to the file index.html
The forthcoming LR6 is anticipated to have HTML5 galleries. -
Code returns "null" and "0"s in main module - why?
I am coding a program that is in two modules. The main module serves it's standard function. The inventory class/module has three functions - 1) request stock input on 4 data points (1 String and 3 integers, one of which is a double) - 2) calculate the value of the inventory, and - 3) return string which reads out the 4 data points and the calculation showing the total value of the inventory. I've created the 3 functions in the inventory class/module, but obviously don't have them referring to each other correctly because when we come to the end of the program the output is null for the String and "0"s for the int/doubles. The code is below - any ideas about how to overcome the empty output? The code compiles fine and acts like it is going to work, but when it comes to the final command line it outputs
"null, which is item number 0, has 0 currently in stock at a price of 0.00 each. The total value of inventory in stock is 0.00"
Main module:
public class Main {
@SuppressWarnings("static-access")
public static void main(String[] args) {
Inventory inventory = new Inventory(); //call Inventory class
inventory.inventoryInput();
Inventory results = new Inventory();
results.inventoryResults(); //call for inventoryResults in Inventory class
}Inventory module:
import java.util.Scanner;
import static java.lang.System.out;
public class Inventory
//declare and initialize variables
int itemNumber = 0;
String productName;
int stockAmount = 0;
double productCost = 0;
double totalValue = 0;
String inventoryResults;
//initialize scanner
Scanner input = new Scanner(System.in);
public void inventoryInput ()
out.println("Please enter item number: "); //prompt for item number
itemNumber = input.nextInt();
out.println( "Enter product name/description: "); //prompt for product name
productName = input.next();
out.println("Quantity in stock: ");
stockAmount = input.nextInt(); // prompt for stock quantity
out.println("What is the product cost for each unit? ");
productCost = input.nextDouble(); // prompt for product cost
} // end inventoryInput
public double totalValue( double stockAmount, double productCost )
totalValue = stockAmount * productCost;
return totalValue; // return stock value
} // end totalValue
public void inventoryResults()
out.printf("%s, which is item number %d, has %d currently in stock at a " +
"price of %.2f each. The total value of inventory in stock is " +
"%.2f\n.", productName, itemNumber, stockAmount, productCost, totalValue);
} // end inventoryResult
}// end methodjustStartingOut wrote:
Actually my final solution was quite simple - I moved the calculation and final formated print text statements into the body of Inventory's class code. It now works. "Works" scares me a bit.
Someone cooking dinner might rummage about in the fridge and the cupboards to see what's there. Do imaginative things with what they come up with. And, with a bit of luck come up with something tasty or, at any rate edible.
A physician deciding on a medical treatment would do well to try a more cautious approach. A specific aim would be a good thing. And a calculated appreciation of the documented effects of each medicine. And how they interact.
It's up to you to determine which approach your coding should resemble. But it seems to me that your original Main class had a perfectly good reason to exist. It was a driver class whose purpose seemed to be to create and use an Inventory. (And using an Inventory is a very different thing from being an Inventory, so it made perfect sense to have two different classes.) To me it works or not, depending on whether it fufills that purpose. And what you have done is not so much solve the problem of it not working, as avoid that problem.
(If by "moved" you mean that the outputting now occurs as part of - or is called from - inventoryInput() then that is not a good thing. The input method should input: just input.)
I think that is because once the original input was loaded into the program (when I entered product number, name, price and value), the entries were dropped when the code switched to the next step. I think your intuition is entirely correct. In particular look at what your original main() method does (my comments replacing yours):
Inventory inventory = new Inventory(); // (A) Create an inventory...
inventory.inventoryInput(); // ... and put stuff into it
// (B) Create some new entirely different (and empty) inventory...
Inventory results = new Inventory();
results.inventoryResults(); // ... and print its contentsInstead of creating a second inventory, try printing the results of the first one.
Edited by: pbrockway2 on Apr 22, 2008 12:37 PM
Whoops ... just read reply 2.
It might sense, though to call totalValue() at the end your input method (because at that point the total value has changed). Or do away with that method - which you worked on getting right in your other thread ;) -
More text options in Print Module
It's frustrating to be able to do just about everything in LR - but not quite. I'd like more text options for the printing module. For example, when I'm printing a limited edition print, I put the edition number in the bottom left corner, under the image, within the border of the print. The title goes in the middle, slighty larger font, and then possibly a watermark.
I can use the Identity Plate to create a nice looking title, but the Photo Info will only print in the middle with no options for positioning it anywhere else, or no options for other fonts.I would second this proposal..... with a serious passion. I think it is unbelievable that Adobe will not provide us with the option to print the metadata with our images.
The current metadata print options are in the dark ages, a joke and an insult to anyone trying to put a proper caption on a printed image. For example, one cannot currently control the postion or font of a basic caption, never mind a considered template which might incorporate copyright, date, author, etc.. I also make folios (ala Lenswork). Unfortunately, a detour to PS also means that this must be done manually, rather than using a template. Adobe have all the tools to make this work, many of them are in the Slideshow module, so already the code is inside Lightroom. It is so sad that a company like Blurb can provide these tools free of charge in free software, but Adobe seem incapable of providing these basic features. I was disappointed they were not in version 1, frustrated when missing from version 2 and apoplectic when not in version 3. I might excuse the omission if I could build a template in PS which allowed me to place text from the metadata into a formattted page layout, but this is not possible either. So despite the fact I have purchased both Lightroom and Photoshop, and paid for upgrade after upgrade of both products, this basic facility is still missing.
I can only deduce that people in Adobe print images in two modes.
1) a lonely image in approx middle of the page with no text formatting or
2) an image in draft mode with a caption and a name plate and uncontolled other text in ad hoc placements (totally unsuitable for presenting to a client).
I would put this requirement ahead of so many other popular requests (even ahead of requests such as networked storage, soft proofing, etc). I can mention other software products who do a really good job of printing meta data with images, do serious work on sharpening, etc. for a fraction of the cost of the Lightroom / Photoshop combination. Becasue I am on an Adobe site I will not mention the names of these non Adobe products. If these small companies can solve this problem, surely Adobe can do so as well.
I also find that I cannot trust the page setup templates that I do create. It seems to me that many of the properties (ie page size, orientation, matt / gloss options) disappear without warning. I suspect this happens when I have problems printing to networked Epson printers (maybe others, but I only use Epson ...with Windows 7.) This is very frustrating when my template changes from Matt in to Gloss, with subsequent wasted of ink and frustration and lost time in correcting and re-updating the template.
Adobe, please finish the Print Module. I do not want any more glitzy updates to publishing to the most recent social media exchange medium. Can we not get basic printing working first.
(..... thanks for listening.....end of rant).
Maybe you are looking for
-
InDesign JPG Compression vs Illustrator/Photoshop
I am working on a website and need to put in a lot of images. For most images, I use photoshop. I create the correct size then export using "Save As for Web & Devices." This works great, but I need to display several small images in a grid format. Wh
-
How to fetch images stored in database to reports
i have stored images in bfile type.i need to access the image.pls do inform me urgently.
-
The 'add to' option doesn't appear in iTunes
When I connect my iPhone5 to my laptop and load iTunes, the 'add to' option doesn't appear so I can't add any files from my computer to my phone... Tested it with my iPad and it works fine... Am I missing something?
-
TS2972 my homesharing turns off after one song from my itunes to my apple tv . Remedy?
Apple tv plays one song from my itunes then stops, says homesharing needs to be turned on. It's already on in itunes.
-
How can I combine a old email address to a new mail address
Had to change email address. But when i bay books on the new mail the old ones i can not read I am getting a message" Document is licensed for a different user account" Any ideas how to over come this